mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Merge master
This commit is contained in:
21 files changed
+135
-80
No files matched your search
@@ -32,8 +32,10 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -105,7 +107,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
TileEntity te = worldIn.getTileEntity(pos);
|
||||
TileEntity te = worldIn instanceof ChunkCache ? ((ChunkCache)worldIn).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : worldIn.getTileEntity(pos);
|
||||
if (te instanceof TileAltar) {
|
||||
TileAltar altar = (TileAltar) te;
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
@@ -76,7 +78,7 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
@Override
|
||||
public IBlockState getExtendedState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
state = super.getExtendedState(state, world, pos);
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TileFloatingSpecialFlower) {
|
||||
state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.SUBTILE_ID, ((TileFloatingSpecialFlower) te).subTileName);
|
||||
}
|
||||
|
||||
@@ -30,8 +30,10 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -89,8 +91,9 @@ public class BlockOpenCrate extends BlockMod implements ILexiconable, IWandable,
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
if (world.getTileEntity(pos) instanceof TileCraftCrate) {
|
||||
TileCraftCrate tile = (TileCraftCrate) world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TileCraftCrate) {
|
||||
TileCraftCrate tile = (TileCraftCrate) te;
|
||||
state = state.withProperty(BotaniaStateProps.CRATE_PATTERN, CratePattern.values()[tile.pattern + 1]);
|
||||
} else {
|
||||
state = state.withProperty(BotaniaStateProps.CRATE_PATTERN, CratePattern.NONE);
|
||||
|
||||
@@ -31,9 +31,11 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
@@ -96,8 +98,9 @@ public class BlockPlatform extends BlockCamo implements ILexiconable, IWandable,
|
||||
state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.HELD_WORLD, world)
|
||||
.withProperty(BotaniaStateProps.HELD_POS, pos);
|
||||
|
||||
if (world.getTileEntity(pos) instanceof TileCamo) {
|
||||
TileCamo tile = (TileCamo) world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TileCamo) {
|
||||
TileCamo tile = (TileCamo) te;
|
||||
return ((IExtendedBlockState) state).withProperty(BotaniaStateProps.HELD_STATE, tile.camoState);
|
||||
} else {
|
||||
return state;
|
||||
|
||||
@@ -40,8 +40,10 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
@@ -146,7 +148,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
|
||||
@Nonnull
|
||||
@Override
|
||||
public IExtendedBlockState getExtendedState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TileSpecialFlower && ((TileSpecialFlower) te).getSubTile() != null) {
|
||||
Class<? extends SubTileEntity> clazz = ((TileSpecialFlower) te).getSubTile().getClass();
|
||||
String id = BotaniaAPI.getSubTileStringMapping(clazz);
|
||||
|
||||
@@ -35,8 +35,10 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
@@ -126,7 +128,7 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
|
||||
@Override
|
||||
public IBlockState getExtendedState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
state = getActualState(state, world, pos);
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TileFloatingFlower) {
|
||||
state = ((IExtendedBlockState) state).withProperty(BotaniaStateProps.ISLAND_TYPE, ((TileFloatingFlower) te).getIslandType());
|
||||
} else if (te instanceof TileFloatingSpecialFlower) {
|
||||
|
||||
@@ -37,8 +37,10 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -104,7 +106,7 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getActualState(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
TileEntity te = world instanceof ChunkCache ? ((ChunkCache)world).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK) : world.getTileEntity(pos);
|
||||
if (te instanceof TilePool) {
|
||||
return state.withProperty(BotaniaStateProps.COLOR, ((TilePool) te).color);
|
||||
} else {
|
||||
|
||||
+3
-1
@@ -19,6 +19,7 @@ import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
@@ -44,9 +45,10 @@ public class SubTileGourmaryllis extends SubTileGenerating {
|
||||
|
||||
if(cooldown > -1)
|
||||
cooldown--;
|
||||
if(cooldown == 0) {
|
||||
if(cooldown == 0 && storedMana != 0) {
|
||||
mana = Math.min(getMaxMana(), mana + storedMana);
|
||||
storedMana = 0;
|
||||
getWorld().playSound(null, supertile.getPos(), SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.BLOCKS, 1, 1);
|
||||
sync();
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public class TileCraftCrate extends TileOpenCrate {
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
||||
if(craft(true) && canEject() || isFull())
|
||||
if(canEject() && isFull() && craft(true))
|
||||
ejectAll();
|
||||
|
||||
int newSignal = 0;
|
||||
@@ -190,7 +190,7 @@ public class TileCraftCrate extends TileOpenCrate {
|
||||
|
||||
@Override
|
||||
public boolean onWanded(World world, EntityPlayer player, ItemStack stack) {
|
||||
if(!world.isRemote) {
|
||||
if(!world.isRemote && canEject()) {
|
||||
craft(false);
|
||||
ejectAll();
|
||||
}
|
||||
|
||||
@@ -104,10 +104,11 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver {
|
||||
EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null;
|
||||
entity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, world.rand.nextFloat() * 360.0F, 0.0F);
|
||||
|
||||
if (entityliving == null || entityliving.getCanSpawnHere())
|
||||
if (entityliving == null || net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(entityliving, logic.getSpawnerWorld(), (float)entity.posX, (float)entity.posY, (float)entity.posZ))
|
||||
{
|
||||
if (randomEntity.getNbt().getSize() == 1 && randomEntity.getNbt().hasKey("id", 8) && entity instanceof EntityLiving)
|
||||
{
|
||||
if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, logic.getSpawnerWorld(), (float)entity.posX, (float)entity.posY, (float)entity.posZ))
|
||||
((EntityLiving)entity).onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entity)), null);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.network.PacketBotaniaEffect;
|
||||
import vazkii.botania.common.network.PacketHandler;
|
||||
|
||||
public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
|
||||
@@ -71,6 +73,9 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if(world.isRemote)
|
||||
return;
|
||||
|
||||
boolean removeMana = true;
|
||||
|
||||
if(hasValidPlatform()) {
|
||||
@@ -88,10 +93,13 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
otherSpark.registerTransfer(spark);
|
||||
}
|
||||
}
|
||||
if(mana > 0)
|
||||
doParticles();
|
||||
if(mana > 0) {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
|
||||
PacketHandler.sendToNearby(world, getPos(),
|
||||
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.TERRA_PLATE, getPos().getX(), getPos().getY(), getPos().getZ()));
|
||||
}
|
||||
|
||||
if(mana >= MAX_MANA && !world.isRemote) {
|
||||
if(mana >= MAX_MANA) {
|
||||
EntityItem item = items.get(0);
|
||||
for(EntityItem otherItem : items)
|
||||
if(otherItem != item)
|
||||
@@ -109,38 +117,6 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
recieveMana(-1000);
|
||||
}
|
||||
|
||||
void doParticles() {
|
||||
if(world.isRemote) {
|
||||
int ticks = (int) (100.0 * ((double) getCurrentMana() / (double) MAX_MANA));
|
||||
|
||||
int totalSpiritCount = 3;
|
||||
double tickIncrement = 360D / totalSpiritCount;
|
||||
|
||||
int speed = 5;
|
||||
double wticks = ticks * speed - tickIncrement;
|
||||
|
||||
double r = Math.sin((ticks - 100) / 10D) * 2;
|
||||
double g = Math.sin(wticks * Math.PI / 180 * 0.55);
|
||||
|
||||
for(int i = 0; i < totalSpiritCount; i++) {
|
||||
double x = pos.getX() + Math.sin(wticks * Math.PI / 180) * r + 0.5;
|
||||
double y = pos.getY() + 0.25 + Math.abs(r) * 0.7;
|
||||
double z = pos.getZ() + Math.cos(wticks * Math.PI / 180) * r + 0.5;
|
||||
|
||||
wticks += tickIncrement;
|
||||
float[] colorsfx = new float[] {
|
||||
0F, (float) ticks / (float) 100, 1F - (float) ticks / (float) 100
|
||||
};
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float)g * 0.05F, 0.25F);
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F);
|
||||
|
||||
if(ticks == 100)
|
||||
for(int j = 0; j < 15; j++)
|
||||
Botania.proxy.wispFX(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<EntityItem> getItems() {
|
||||
return world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
|
||||
}
|
||||
|
||||
@@ -48,13 +48,17 @@ import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.api.subtile.ISpecialFlower;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
import vazkii.botania.api.subtile.SubTileGenerating;
|
||||
import vazkii.botania.client.core.handler.BossBarHandler;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.BlockModFlower;
|
||||
import vazkii.botania.common.block.BlockSpecialFlower;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.decor.BlockFloatingFlower;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileSolegnolia;
|
||||
import vazkii.botania.common.integration.corporea.WrappedDeepStorage;
|
||||
import vazkii.botania.common.integration.corporea.WrappedIInventory;
|
||||
@@ -255,7 +259,7 @@ public class InternalMethodHandler extends DummyMethodHandler {
|
||||
@Override
|
||||
public boolean isBotaniaFlower(World world, BlockPos pos) {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
return block == ModBlocks.flower || block == ModBlocks.shinyFlower || block == ModBlocks.specialFlower;
|
||||
return block instanceof BlockModFlower || block instanceof BlockFloatingFlower || block instanceof ISpecialFlower;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,10 +45,4 @@ public class ItemCrystalBow extends ItemLivingwoodBow {
|
||||
if(living instanceof EntityPlayer)
|
||||
ManaItemHandler.requestManaExactForTool(stack, (EntityPlayer) living, ARROW_COST / (infinity ? 2 : 1), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getAmmo(EntityLivingBase player) {
|
||||
return new ItemStack(Items.ARROW);
|
||||
}
|
||||
|
||||
}
|
||||
+21
-17
@@ -105,17 +105,14 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(@Nonnull ItemStack stack, @Nonnull World world, EntityLivingBase shooter, int useTicks) {
|
||||
|
||||
boolean isPlayer = shooter instanceof EntityPlayer;
|
||||
EntityPlayer player = isPlayer ? (EntityPlayer) shooter : null;
|
||||
EntityPlayer player = (EntityPlayer) shooter;
|
||||
|
||||
// Begin copy modified ItemBow.onPlayerStoppedUsing
|
||||
boolean flag = !isPlayer || canFire(stack, player); // Botania - Custom canFire check
|
||||
ItemStack itemstack = getAmmo(shooter);
|
||||
boolean flag = canFire(stack, player); // Botania - Custom canFire check
|
||||
ItemStack itemstack = getAmmo(player);
|
||||
|
||||
int i = (int) ((getMaxItemUseDuration(stack) - useTicks) * chargeVelocityMultiplier()); // Botania - velocity multiplier
|
||||
if(isPlayer)
|
||||
i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(stack, world, player, i, !itemstack.isEmpty() || flag);
|
||||
i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(stack, world, player, i, !itemstack.isEmpty() || flag);
|
||||
if (i < 0) return;
|
||||
|
||||
if (!itemstack.isEmpty() || flag)
|
||||
@@ -129,7 +126,7 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel
|
||||
|
||||
if (f >= 0.1D)
|
||||
{
|
||||
boolean infinite = !isPlayer || player.capabilities.isCreativeMode || itemstack.getItem() instanceof ItemArrow && ((ItemArrow) itemstack.getItem()).isInfinite(itemstack, stack, player);
|
||||
boolean infinite = player.capabilities.isCreativeMode || (itemstack.getItem() instanceof ItemArrow ? ((ItemArrow)itemstack.getItem()).isInfinite(itemstack, stack, player) : false);
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
@@ -175,10 +172,7 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel
|
||||
|
||||
world.playSound(null, shooter.posX, shooter.posY, shooter.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
|
||||
|
||||
// Botania - move ammo consumption into onFire (above)
|
||||
|
||||
if(isPlayer)
|
||||
player.addStat(StatList.getObjectUseStats(this));
|
||||
player.addStat(StatList.getObjectUseStats(this));
|
||||
}
|
||||
}
|
||||
// End modified ItemBow.onPlayerStoppedUsing
|
||||
@@ -195,7 +189,8 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel
|
||||
void onFire(ItemStack bow, EntityLivingBase living, boolean infinity, EntityArrow arrow) {
|
||||
if(living instanceof EntityPlayerMP) {
|
||||
ToolCommons.damageItem(bow, 1, living, MANA_PER_DAMAGE);
|
||||
if(((EntityPlayerMP) living).interactionManager.getGameType().isSurvivalOrAdventure())
|
||||
|
||||
if(((EntityPlayerMP) living).interactionManager.getGameType().isSurvivalOrAdventure() && !infinity)
|
||||
PlayerHelper.consumeAmmo((EntityPlayerMP) living, AMMO_FUNC);
|
||||
}
|
||||
}
|
||||
@@ -216,10 +211,19 @@ public class ItemLivingwoodBow extends ItemBow implements IManaUsingItem, IModel
|
||||
return true;
|
||||
}
|
||||
|
||||
protected ItemStack getAmmo(EntityLivingBase shooter) {
|
||||
if(shooter instanceof EntityPlayer)
|
||||
return PlayerHelper.getAmmo((EntityPlayer) shooter, AMMO_FUNC);
|
||||
else return new ItemStack(Items.ARROW);
|
||||
private ItemStack getAmmo(EntityPlayer player) {
|
||||
if(isArrow(player.getHeldItem(EnumHand.OFF_HAND)))
|
||||
return player.getHeldItem(EnumHand.OFF_HAND);
|
||||
else if(isArrow(player.getHeldItem(EnumHand.MAIN_HAND)))
|
||||
return player.getHeldItem(EnumHand.MAIN_HAND);
|
||||
else for(int i = 0; i < player.inventory.getSizeInventory(); ++i) {
|
||||
ItemStack itemstack = player.inventory.getStackInSlot(i);
|
||||
|
||||
if (isArrow(itemstack))
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -65,7 +65,13 @@ public class ItemKingKey extends ItemRelic implements IManaUsingItem {
|
||||
int spawned = getWeaponsSpawned(stack);
|
||||
|
||||
if(count != getMaxItemUseDuration(stack) && spawned < 20 && !living.world.isRemote && (!(living instanceof EntityPlayer) || ManaItemHandler.requestManaExact(stack, (EntityPlayer) living, 150, true))) {
|
||||
Vector3 look = new Vector3(living.getLookVec()).multiply(1, 0, 1).normalize().multiply(-2);;
|
||||
Vector3 look = new Vector3(living.getLookVec()).multiply(1, 0, 1);
|
||||
|
||||
double playerRot = Math.toRadians(living.rotationYaw + 90);
|
||||
if(look.x == 0 && look.z == 0)
|
||||
look = new Vector3(Math.cos(playerRot), 0, Math.sin(playerRot));
|
||||
|
||||
look = look.normalize().multiply(-2);
|
||||
|
||||
int div = spawned / 5;
|
||||
int mod = spawned % 5;
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
@@ -69,7 +70,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
|
||||
public static void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) {
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
ItemStack lokiRing = getLokiRing(player);
|
||||
if(lokiRing == null || player.world.isRemote)
|
||||
if(lokiRing.isEmpty() || player.world.isRemote || event.getHand() == EnumHand.OFF_HAND)
|
||||
return;
|
||||
|
||||
int slot = -1;
|
||||
@@ -136,7 +137,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
|
||||
|
||||
public static void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, BlockPos pos, EnumFacing side) {
|
||||
ItemStack lokiRing = getLokiRing(player);
|
||||
if(lokiRing == null || player.world.isRemote || !(item instanceof ISequentialBreaker))
|
||||
if(lokiRing.isEmpty() || player.world.isRemote || !(item instanceof ISequentialBreaker))
|
||||
return;
|
||||
|
||||
List<BlockPos> cursors = getCursorList(lokiRing);
|
||||
@@ -198,7 +199,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
|
||||
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
|
||||
ItemStack stack1 = baubles.getStackInSlot(1);
|
||||
ItemStack stack2 = baubles.getStackInSlot(2);
|
||||
return isLokiRing(stack1) ? stack1 : isLokiRing(stack2) ? stack2 : null;
|
||||
return isLokiRing(stack1) ? stack1 : isLokiRing(stack2) ? stack2 : ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
private static boolean isLokiRing(ItemStack stack) {
|
||||
@@ -235,6 +236,9 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
|
||||
}
|
||||
|
||||
private static void setCursorList(ItemStack stack, List<BlockPos> cursors) {
|
||||
if(stack == null)
|
||||
return;
|
||||
|
||||
NBTTagCompound cmp = new NBTTagCompound();
|
||||
if(cursors != null) {
|
||||
int i = 0;
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -15,6 +16,7 @@ import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.tile.TileTerraPlate;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
@@ -251,6 +253,38 @@ public class PacketBotaniaEffect implements IMessage {
|
||||
Botania.proxy.wispFX(message.x + 0.7 - Math.random() * 0.4, message.y + 0.9 - Math.random() * 0.2, message.z + 0.7 - Math.random() * 0.4, 0.2F, 0.2F, 0.2F, 0.1F + (float) Math.random() * 0.2F, 0.05F - (float) Math.random() * 0.1F, 0.05F + (float) Math.random() * 0.03F, 0.05F - (float) Math.random() * 0.1F);
|
||||
}
|
||||
}
|
||||
case TERRA_PLATE: {
|
||||
TileEntity te = world.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
||||
if(te instanceof TileTerraPlate) {
|
||||
int ticks = (int) (100.0 * ((double) ((TileTerraPlate) te).getCurrentMana() / (double) TileTerraPlate.MAX_MANA));
|
||||
|
||||
int totalSpiritCount = 3;
|
||||
double tickIncrement = 360D / totalSpiritCount;
|
||||
|
||||
int speed = 5;
|
||||
double wticks = ticks * speed - tickIncrement;
|
||||
|
||||
double r = Math.sin((ticks - 100) / 10D) * 2;
|
||||
double g = Math.sin(wticks * Math.PI / 180 * 0.55);
|
||||
|
||||
for(int i = 0; i < totalSpiritCount; i++) {
|
||||
double x = message.x + Math.sin(wticks * Math.PI / 180) * r + 0.5;
|
||||
double y = message.y + 0.25 + Math.abs(r) * 0.7;
|
||||
double z = message.z + Math.cos(wticks * Math.PI / 180) * r + 0.5;
|
||||
|
||||
wticks += tickIncrement;
|
||||
float[] colorsfx = new float[] {
|
||||
0F, (float) ticks / (float) 100, 1F - (float) ticks / (float) 100
|
||||
};
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float)g * 0.05F, 0.25F);
|
||||
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F);
|
||||
|
||||
if(ticks == 100)
|
||||
for(int j = 0; j < 15; j++)
|
||||
Botania.proxy.wispFX(message.x + 0.5, message.y + 0.5, message.z + 0.5, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -271,7 +305,8 @@ public class PacketBotaniaEffect implements IMessage {
|
||||
ENCHANTER_DESTROY(0),
|
||||
ENTROPINNYUM(0),
|
||||
BLACK_LOTUS_DISSOLVE(0),
|
||||
BREWERY_FINISH(1); // Arg: RGB
|
||||
BREWERY_FINISH(1), // Arg: RGB
|
||||
TERRA_PLATE(0);
|
||||
|
||||
private final int argCount;
|
||||
|
||||
|
||||
Reference in new issue
Block a user