Most TE's

This commit is contained in:
Vincent Lee committed 2016-03-19 09:59:45 -05:00
1 parent 5cc6879ecb
commit 268a8afda5
22 files changed
+99 -81

No files matched your search

@@ -358,7 +358,7 @@ public class TileAlfPortal extends TileMod {
IBlockState stateat = worldObj.getBlockState(pos_);
Block blockat = stateat.getBlock();
if(state.getBlock() == Blocks.air ? blockat.isAir(worldObj, pos_) : blockat == state.getBlock()) {
if(state.getBlock() == Blocks.air ? blockat.isAir(stateat, worldObj, pos_) : blockat == state.getBlock()) {
return onlyCheckBlock || stateat == state;
}
@@ -22,9 +22,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.text.translation.I18n;
@@ -37,6 +39,7 @@ import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.item.IPetalApothecary;
import vazkii.botania.api.recipe.IFlowerComponent;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.api.sound.BotaniaSoundEvents;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.AltarVariant;
import vazkii.botania.client.core.handler.HUDHandler;
@@ -113,7 +116,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
stackToPut.stackSize = 1;
itemHandler.setStackInSlot(i, stackToPut);
didChange = true;
worldObj.playSoundAtEntity(item, "game.neutral.swim.splash", 0.1F, 1F);
worldObj.playSound(null, pos, SoundEvents.entity_generic_splash, SoundCategory.BLOCKS, 0.1F, 10F);
break;
}
}
@@ -195,7 +198,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
if(didAny) {
if(inv instanceof TileAltar)
player.worldObj.playSoundAtEntity(player, "game.neutral.swim.splash", 0.1F, 1F);
player.worldObj.playSound(null, ((TileAltar) inv).getPos(), SoundEvents.entity_generic_splash, SoundCategory.BLOCKS, 0.1F, 10F);
if(player instanceof EntityPlayerMP) {
EntityPlayerMP mp = (EntityPlayerMP) player;
mp.inventoryContainer.detectAndSendChanges();
@@ -204,7 +207,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
}
public void craftingFanciness() {
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:altarCraft", 1F, 1F);
worldObj.playSound(null, pos, BotaniaSoundEvents.altarCraft, SoundCategory.BLOCKS, 1F, 1F);
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
@@ -243,7 +246,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
float green = color.getGreen() / 255F;
float blue = color.getBlue() / 255F;
if(Math.random() >= 0.75F)
worldObj.playSoundEffect(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, "game.neutral.swim.splash", 0.1F, 10F);
worldObj.playSound(null, pos, SoundEvents.entity_generic_splash, SoundCategory.BLOCKS, 0.1F, 10F);
Botania.proxy.sparkleFX(worldObj, pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
}
}
@@ -17,8 +17,10 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.IBrewContainer;
@@ -26,6 +28,7 @@ import vazkii.botania.api.brew.IBrewItem;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.api.sound.BotaniaSoundEvents;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.common.Botania;
@@ -158,7 +161,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
}
public void craftingFanciness() {
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:potionCreate", 1F, 1.5F + (float) Math.random() * 0.25F);
worldObj.playSound(null, pos, BotaniaSoundEvents.potionCreate, SoundCategory.BLOCKS, 1F, 1.5F + (float) Math.random() * 0.25F);
for(int i = 0; i < 25; i++) {
Color color = new Color(recipe.getBrew().getColor(itemHandler.getStackInSlot(0)));
float r = color.getRed() / 255F;
@@ -20,6 +20,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentData;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
@@ -30,6 +31,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
@@ -43,6 +46,7 @@ import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkHelper;
import vazkii.botania.api.sound.BotaniaSoundEvents;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.common.Botania;
@@ -121,7 +125,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
if(enchants != null && enchants.tagCount() > 0) {
NBTTagCompound enchant = enchants.getCompoundTagAt(0);
short id = enchant.getShort("id");
if(isEnchantmentValid(id)) {
if(isEnchantmentValid(Enchantment.getEnchantmentByID(id))) {
advanceStage();
return;
}
@@ -151,7 +155,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
float blue = (float) Math.random();
Botania.proxy.wispFX(worldObj, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, red, green, blue, (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.25F, (float) (Math.random() - 0.5F) * 0.25F, (float) (Math.random() - 0.5F) * 0.25F);
}
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:enchanterBlock", 0.5F, 10F);
worldObj.playSound(null, pos, BotaniaSoundEvents.enchanterBlock, SoundCategory.BLOCKS, 0.5F, 10F);
}
switch(stage) {
@@ -170,9 +174,10 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
NBTTagCompound enchant = enchants.getCompoundTagAt(0);
short enchantId = enchant.getShort("id");
short enchantLvl = enchant.getShort("lvl");
if(!hasEnchantAlready(enchantId) && isEnchantmentValid(enchantId)) {
this.enchants.add(new EnchantmentData(enchantId, enchantLvl));
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:ding", 1F, 1F);
Enchantment ench = Enchantment.getEnchantmentByID(enchantId);
if(!hasEnchantAlready(ench) && isEnchantmentValid(ench)) {
this.enchants.add(new EnchantmentData(ench, enchantLvl));
worldObj.playSound(null, pos, BotaniaSoundEvents.ding, SoundCategory.BLOCKS, 1F, 1F);
addedEnch = true;
break;
}
@@ -201,8 +206,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
if(manaRequired == -1) {
manaRequired = 0;
for(EnchantmentData data : enchants) {
Enchantment ench = Enchantment.getEnchantmentById(data.enchant);
manaRequired += (int) (5000F * ((15 - Math.min(15, ench.getWeight())) * 1.05F) * ((3F + data.level * data.level) * 0.25F) * (0.9F + enchants.size() * 0.05F));
manaRequired += (int) (5000F * ((15 - Math.min(15, data.enchantmentobj.getWeight().getWeight())) * 1.05F) * ((3F + data.enchantmentLevel * data.enchantmentLevel) * 0.25F) * (0.9F + enchants.size() * 0.05F));
}
} else if(mana >= manaRequired) {
manaRequired = 0;
@@ -229,8 +233,8 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
case 3 : { // Enchant
if(stageTicks >= 100) {
for(EnchantmentData data : enchants)
if(EnchantmentHelper.getEnchantmentLevel(data.enchant, itemToEnchant) == 0)
itemToEnchant.addEnchantment(Enchantment.getEnchantmentById(data.enchant), data.level);
if(EnchantmentHelper.getEnchantmentLevel(data.enchantmentobj, itemToEnchant) == 0)
itemToEnchant.addEnchantment(data.enchantmentobj, data.enchantmentLevel);
enchants.clear();
manaRequired = -1;
@@ -268,7 +272,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
}
public void craftingFanciness() {
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:enchanterEnchant", 1F, 1F);
worldObj.playSound(null, pos, BotaniaSoundEvents.enchanterEnchant, SoundCategory.BLOCKS, 1F, 1F);
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
@@ -321,7 +325,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
String enchStr = "";
for(EnchantmentData data : enchants)
enchStr = enchStr + data.enchant + ":" + data.level + ",";
enchStr = enchStr + Enchantment.enchantmentRegistry.getNameForObject(data.enchantmentobj) + ":" + data.enchantmentLevel + ",";
cmp.setString(TAG_ENCHANTS, enchStr.isEmpty() ? enchStr : enchStr.substring(0, enchStr.length() - 1));
}
@@ -342,28 +346,29 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
String[] enchTokens = enchStr.split(",");
for(String token : enchTokens) {
String[] entryTokens = token.split(":");
int id = Integer.parseInt(entryTokens[0]);
Enchantment ench = Enchantment.getEnchantmentByLocation(entryTokens[0]);
if(ench == null)
ench = Enchantment.getEnchantmentByID(Integer.parseInt(entryTokens[0]));
int lvl = Integer.parseInt(entryTokens[1]);
enchants.add(new EnchantmentData(id, lvl));
enchants.add(new EnchantmentData(ench, lvl));
}
}
}
private boolean hasEnchantAlready(int enchant) {
private boolean hasEnchantAlready(Enchantment enchant) {
for(EnchantmentData data : enchants)
if(data.enchant == enchant)
if(data.enchantmentobj == enchant)
return true;
return false;
}
public boolean isEnchantmentValid(short id) {
Enchantment ench = Enchantment.getEnchantmentById(id);
public boolean isEnchantmentValid(Enchantment ench) {
if(!ench.canApply(itemToEnchant) || !ench.type.canEnchantItem(itemToEnchant.getItem()))
return false;
for(EnchantmentData data : enchants) {
Enchantment otherEnch = Enchantment.getEnchantmentById(data.enchant);
Enchantment otherEnch = data.enchantmentobj;
if(!otherEnch.canApplyTogether(ench) || !ench.canApplyTogether(otherEnch))
return false;
}
@@ -427,14 +432,4 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
}
}
private static class EnchantmentData {
public int enchant, level;
public EnchantmentData(int enchant, int level) {
this.enchant = enchant;
this.level = level;
}
}
}
@@ -14,6 +14,7 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumParticleTypes;
@@ -36,7 +37,7 @@ public class TileEnderEye extends TileMod {
boolean looking = false;
for(EntityPlayer player : players) {
ItemStack helm = player.getCurrentArmor(3);
ItemStack helm = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if(helm != null && helm.getItem() == Item.getItemFromBlock(Blocks.pumpkin))
continue;
@@ -14,10 +14,13 @@ import java.awt.Color;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.fml.common.registry.GameData;
import vazkii.botania.api.BotaniaAPI;
@@ -49,16 +52,16 @@ public class TileIncensePlate extends TileSimpleInventory {
if(!worldObj.isRemote) {
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos.getX() + 0.5 - RANGE, pos.getY() + 0.5 - RANGE, pos.getZ() + 0.5 - RANGE, pos.getX() + 0.5 + RANGE, pos.getY() + 0.5 + RANGE, pos.getZ() + 0.5 + RANGE));
for(EntityPlayer player : players) {
PotionEffect currentEffect = player.getActivePotionEffect(GameData.getPotionRegistry().getObjectById(effect.getPotionID()));
boolean nightVision = effect.getPotionID() == Potion.nightVision.getId();
PotionEffect currentEffect = player.getActivePotionEffect(effect.getPotion());
boolean nightVision = effect.getPotion() == MobEffects.nightVision;
if(currentEffect == null || currentEffect.getDuration() < (nightVision ? 205 : 3)) {
PotionEffect applyEffect = new PotionEffect(effect.getPotionID(), nightVision ? 285 : 80, effect.getAmplifier(), true, true);
PotionEffect applyEffect = new PotionEffect(effect.getPotion(), nightVision ? 285 : 80, effect.getAmplifier(), true, true);
player.addPotionEffect(applyEffect);
}
}
if(worldObj.rand.nextInt(20) == 0)
worldObj.playSoundEffect(pos.getX() + 0.5, pos.getY() + 0.1, pos.getZ() + 0.5, "fire.fire", 0.1F, 1F);
worldObj.playSound(null, pos, SoundEvents.block_fire_ambient, SoundCategory.BLOCKS, 0.1F, 1);
} else {
double x = pos.getX() + 0.5;
double y = pos.getY() + 0.5;
@@ -53,7 +53,7 @@ public class TileLightRelay extends TileMod implements IWandBindable {
EntityPlayerMover mover = new EntityPlayerMover(worldObj, pos, bindPos);
worldObj.spawnEntityInWorld(mover);
e.mountEntity(mover);
e.startRiding(mover);
if(!(e instanceof EntityItem)) {
worldObj.playSoundAtEntity(mover, "botania:lightRelay", 0.2F, (float) Math.random() * 0.3F + 0.7F);
if(e instanceof EntityPlayer)
@@ -206,7 +206,7 @@ public class TileLightRelay extends TileMod implements IWandBindable {
public void onUpdate() {
super.onUpdate();
if(riddenByEntity == null && !worldObj.isRemote) {
if(getPassengers().isEmpty() && !worldObj.isRemote) {
setDead();
return;
}
@@ -61,8 +61,9 @@ public class TileOpenCrate extends TileSimpleInventory {
}
public boolean canEject() {
Block blockBelow = worldObj.getBlockState(pos.down()).getBlock();
return blockBelow.isAir(worldObj, pos.down()) || blockBelow.getCollisionBoundingBox(worldObj, pos.down(), worldObj.getBlockState(pos.down())) == null;
IBlockState stateBelow = worldObj.getBlockState(pos.down());
Block blockBelow = stateBelow.getBlock();
return blockBelow.isAir(stateBelow, worldObj, pos.down()) || stateBelow.getCollisionBoundingBox(worldObj, pos.down()) == null;
}
public void eject(ItemStack stack, boolean redstone) {
@@ -53,7 +53,7 @@ public class TilePlatform extends TileCamo implements IManaCollisionGhost {
void swap(TilePlatform tile, boolean empty) {
tile.camoState = empty ? null : camoState;
worldObj.markBlockForUpdate(tile.getPos());
worldObj.notifyBlockUpdate(tile.getPos(), worldObj.getBlockState(tile.getPos()), worldObj.getBlockState(tile.getPos()), 8);
}
}
@@ -30,8 +30,6 @@ public class TilePylon extends TileEntity implements ITickable {
BlockPos centerPos;
int ticks = 0;
@Override
public void update() {
++ticks;
@@ -20,6 +20,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.text.translation.I18n;
@@ -30,6 +31,7 @@ import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import vazkii.botania.api.sound.BotaniaSoundEvents;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.common.Botania;
@@ -165,7 +167,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
}
if(manaToGet != this.manaToGet) {
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:runeAltarStart", 1F, 1F);
worldObj.playSound(null, pos, BotaniaSoundEvents.runeAltarStart, SoundCategory.BLOCKS, 1, 1);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, pos);
}
}
@@ -253,7 +255,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
}
public void craftingFanciness() {
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:runeAltarCraft", 1F, 1F);
worldObj.playSound(null, pos, BotaniaSoundEvents.runeAltarCraft, SoundCategory.BLOCKS, 1, 1);
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
@@ -19,6 +19,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.MobSpawnerBaseLogic;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.WeightedSpawnerEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.WeightedRandom;
import vazkii.botania.api.mana.IManaReceiver;
@@ -130,7 +131,7 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver {
}
if(potentialEntitySpawns != null && potentialEntitySpawns.size() > 0)
logic.setRandomEntity((MobSpawnerBaseLogic.WeightedRandomMinecart)WeightedRandom.getRandomItem(logic.getSpawnerWorld().rand, potentialEntitySpawns));
logic.func_184993_a((WeightedSpawnerEntity)WeightedRandom.getRandomItem(logic.getSpawnerWorld().rand, potentialEntitySpawns));
logic.func_98267_a(1);
}
@@ -19,6 +19,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
@@ -28,6 +29,7 @@ import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkHelper;
import vazkii.botania.api.sound.BotaniaSoundEvents;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.mana.TilePool;
@@ -94,7 +96,7 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
if(otherItem != item)
otherItem.setDead();
else item.setEntityItemStack(new ItemStack(ModItems.manaResource, 1, 4));
item.worldObj.playSoundAtEntity(item, "botania:terrasteelCraft", 1F, 1F);
worldObj.playSound(null, item.posX, item.posY, item.posZ, BotaniaSoundEvents.terrasteelCraft, SoundCategory.BLOCKS, 1, 1);
mana = 0;
worldObj.updateComparatorOutputLevel(pos, worldObj.getBlockState(pos).getBlock());
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, pos);
@@ -11,6 +11,8 @@
package vazkii.botania.common.block.tile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.SoundCategory;
import vazkii.botania.api.sound.BotaniaSoundEvents;
public class TileTinyPotato extends TileMod {
@@ -25,7 +27,7 @@ public class TileTinyPotato extends TileMod {
jump();
if(name.equalsIgnoreCase("shia labeouf") && !worldObj.isRemote && nextDoIt == 0) {
nextDoIt = 40;
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:doit", 1F, 1F);
worldObj.playSound(null, pos, BotaniaSoundEvents.doit, SoundCategory.BLOCKS, 1F, 1F);
}
}
@@ -239,9 +239,9 @@ public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequ
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onChatMessage(ServerChatEvent event) {
List<TileCorporeaIndex> nearbyIndexes = getNearbyIndexes(event.player);
List<TileCorporeaIndex> nearbyIndexes = getNearbyIndexes(event.getPlayer());
if(!nearbyIndexes.isEmpty()) {
String msg = event.message.toLowerCase().trim();
String msg = event.getMessage().toLowerCase().trim();
for(TileCorporeaIndex index : nearbyIndexes) {
if(index.worldObj.isRemote)
continue;
@@ -261,16 +261,16 @@ public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequ
}
if(name.equals("this")) {
ItemStack stack = event.player.getCurrentEquippedItem();
ItemStack stack = event.getPlayer().getHeldItemMainhand();
if(stack != null)
name = stack.getDisplayName().toLowerCase().trim();
}
index.doCorporeaRequest(name, count, spark);
event.player.addChatMessage(new TextComponentTranslation("botaniamisc.requestMsg", count, WordUtils.capitalizeFully(name), CorporeaHelper.lastRequestMatches, CorporeaHelper.lastRequestExtractions).setChatStyle(new Style().setColor(TextFormatting.LIGHT_PURPLE)));
event.getPlayer().addChatMessage(new TextComponentTranslation("botaniamisc.requestMsg", count, WordUtils.capitalizeFully(name), CorporeaHelper.lastRequestMatches, CorporeaHelper.lastRequestExtractions).setChatStyle(new Style().setColor(TextFormatting.LIGHT_PURPLE)));
if(CorporeaHelper.lastRequestExtractions >= 50000)
event.player.addStat(ModAchievements.superCorporeaRequest, 1);
event.getPlayer().addStat(ModAchievements.superCorporeaRequest, 1);
}
}
@@ -17,7 +17,9 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.sound.BotaniaSoundEvents;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.subtile.functional.SubTileExoflame;
import vazkii.botania.common.block.tile.TileMod;
@@ -56,7 +58,7 @@ public class TileBellows extends TileMod {
if(movePos < max && active && moving >= 0F) {
if(moving == 0F)
worldObj.playSoundEffect(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, "botania:bellows", 0.1F, 3F);
worldObj.playSound(null, pos, BotaniaSoundEvents.bellows, SoundCategory.BLOCKS, 0.1F, 3F);
if(tile instanceof TileEntityFurnace) {
TileEntityFurnace furnace = (TileEntityFurnace) tile;
@@ -27,6 +27,7 @@ import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.AxisAlignedBB;
@@ -48,6 +49,7 @@ import vazkii.botania.api.mana.ManaNetworkEvent;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.api.sound.BotaniaSoundEvents;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.PoolVariant;
import vazkii.botania.client.core.handler.HUDHandler;
@@ -193,7 +195,7 @@ public class TilePool extends TileMod implements IManaPool, IDyablePool, IKeyLoc
public void craftingFanciness() {
if(soundTicks == 0) {
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:manaPoolCraft", 0.4F, 4F);
worldObj.playSound(null, pos, BotaniaSoundEvents.manaPoolCraft, SoundCategory.BLOCKS, 0.4F, 4F);
soundTicks = 6;
}
@@ -354,7 +356,7 @@ public class TilePool extends TileMod implements IManaPool, IDyablePool, IKeyLoc
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new SPacketUpdateTileEntity(pos, -999, nbttagcompound));
}
worldObj.playSoundAtEntity(player, "botania:ding", 0.11F, 1F);
worldObj.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.ding, SoundCategory.PLAYERS, 0.11F, 1F);
}
public void renderHUD(Minecraft mc, ScaledResolution res) {
@@ -29,7 +29,10 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
@@ -48,6 +51,7 @@ import vazkii.botania.api.mana.IManaSpreader;
import vazkii.botania.api.mana.IRedirectable;
import vazkii.botania.api.mana.IThrottledPacket;
import vazkii.botania.api.mana.ManaNetworkEvent;
import vazkii.botania.api.sound.BotaniaSoundEvents;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.SpreaderVariant;
import vazkii.botania.api.wand.IWandBindable;
@@ -382,7 +386,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
if(player instanceof EntityPlayerMP)
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new SPacketUpdateTileEntity(pos, -999, nbttagcompound));
}
worldObj.playSoundAtEntity(player, "botania:ding", 0.1F, 1F);
worldObj.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.ding, SoundCategory.PLAYERS, 0.1F, 1);
} else {
RayTraceResult pos = raytraceFromEntity(worldObj, player, true, 5);
if(pos != null && pos.hitVec != null && !worldObj.isRemote) {
@@ -437,7 +441,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
worldObj.spawnEntityInWorld(burst);
burst.ping();
if(!ConfigHandler.silentSpreaders)
worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "botania:spreaderFire", 0.05F * (paddingColor != -1 ? 0.2F : 1F), 0.7F + 0.3F * (float) Math.random());
worldObj.playSound(null, pos, BotaniaSoundEvents.spreaderFire, SoundCategory.BLOCKS, 0.05F * (paddingColor != -1 ? 0.2F : 1F), 0.7F + 0.3F * (float) Math.random());
}
}
}
@@ -546,7 +550,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
float f8 = f3 * f5;
double d3 = range;
if (player instanceof EntityPlayerMP)
d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
d3 = ((EntityPlayerMP) player).interactionManager.getBlockReachDistance();
Vec3d vec31 = vec3.addVector(f7 * d3, f6 * d3, f8 * d3);
return world.rayTraceBlocks(vec3, vec31, par3, !par3, par3);
}
@@ -672,7 +676,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
Vector3 thisVec = Vector3.fromTileEntityCenter(this);
Vector3 blockVec = new Vector3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
AxisAlignedBB axis = player.worldObj.getBlockState(pos).getBlock().getCollisionBoundingBox(player.worldObj, pos, player.worldObj.getBlockState(pos));
AxisAlignedBB axis = player.worldObj.getBlockState(pos).getCollisionBoundingBox(player.worldObj, pos);
if(axis == null)
axis = new AxisAlignedBB(pos, pos.add(1, 1, 1));
@@ -11,6 +11,7 @@
package vazkii.botania.common.block.tile.string;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.AxisAlignedBB;
@@ -83,9 +84,13 @@ public abstract class TileRedString extends TileMod implements ITileBound {
return binding == null ? null : worldObj.getTileEntity(binding);
}
public Block getBlockAtBinding() {
public IBlockState getStateAtBinding() {
BlockPos binding = getBinding();
return binding == null ? Blocks.air : worldObj.getBlockState(binding).getBlock();
return binding == null ? Blocks.air.getDefaultState() : worldObj.getBlockState(binding);
}
public Block getBlockAtBinding() {
return getStateAtBinding().getBlock();
}
@Override
@@ -11,6 +11,7 @@
package vazkii.botania.common.block.tile.string;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
@@ -23,12 +24,11 @@ public class TileRedStringComparator extends TileRedString {
super.updateEntity();
BlockPos binding = getBinding();
EnumFacing dir = getOrientation();
Block block = getBlockAtBinding();
IBlockState state = getStateAtBinding();
int origVal = comparatorValue;
if(block.hasComparatorInputOverride()) {
int val = block.getComparatorInputOverride(worldObj, binding);
comparatorValue = val;
if(state.hasComparatorInputOverride()) {
comparatorValue = state.getComparatorInputOverride(worldObj, binding);
} else comparatorValue = 0;
if(origVal != comparatorValue)
@@ -41,8 +41,7 @@ public class TileRedStringComparator extends TileRedString {
@Override
public boolean acceptBlock(BlockPos pos) {
Block block = worldObj.getBlockState(pos).getBlock();
return block.hasComparatorInputOverride();
return worldObj.getBlockState(pos).hasComparatorInputOverride();
}
}
@@ -10,19 +10,11 @@
*/
package vazkii.botania.common.block.tile.string;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.CapabilityItemHandler;
import vazkii.botania.common.core.helper.InventoryHelper;
import vazkii.botania.common.lib.LibBlockNames;
import java.util.Arrays;
@@ -15,6 +15,9 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import vazkii.botania.api.state.BotaniaStateProps;
@@ -68,8 +71,8 @@ public class TileRedStringInterceptor extends TileRedString {
interceptors.removeAll(remove);
if(did) {
if(world.isRemote)
player.swingItem();
else world.playSoundEffect(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, "random.click", 0.3F, 0.6F);
player.swingArm(EnumHand.MAIN_HAND); // todo 1.9
else world.playSound(null, pos, SoundEvents.block_dispenser_dispense, SoundCategory.BLOCKS, 0.3F, 0.6F);
}
}