Merge branch 'master' of github.com:Vazkii/Botania into flattening_test

This commit is contained in:
Vincent Lee committed 2018-01-11 23:31:56 -06:00
commit 0d0eaeb121
67 files changed
+339 -402

No files matched your search

@@ -411,7 +411,7 @@ public final class BotaniaAPI {
/**
* Registers a Pure Daisy Recipe with the default time
* @param input The block that works as an input for the recipe. Can be a Block or an oredict String.
* @param input The input for the recipe. Can be a Block (meta-insensitive), IBlockState (meta-sensitive), or an oredict String.
* @param outputState The blockstate to be placed upon recipe completion.
* @return The recipe created.
*/
@@ -421,7 +421,7 @@ public final class BotaniaAPI {
/**
* Registers a Pure Daisy Recipe.
* @param input The block that works as an input for the recipe. Can be a Block or an oredict String.
* @param input The input for the recipe. Can be a Block (meta-insensitive), IBlockState (meta-sensitive), or an oredict String.
* @param outputState The blockstate to be placed upon recipe completion.
* @param time The amount of time in ticks to complete this recipe. Note that this is ticks on your block, not total time.
* The Pure Daisy only ticks one block at a time in a round robin fashion.
@@ -41,8 +41,8 @@ public class RecipePureDaisy {
this.input = input;
outputState = state;
this.time = time;
if(input != null && !(input instanceof String || input instanceof Block))
throw new IllegalArgumentException("input must be an oredict String or a Block.");
if(input != null && !(input instanceof String || input instanceof Block || input instanceof IBlockState))
throw new IllegalArgumentException("input must be an oredict String, Block, or IBlockState");
}
/**
@@ -52,6 +52,9 @@ public class RecipePureDaisy {
if(input instanceof Block)
return state.getBlock() == input;
if(input instanceof IBlockState)
return state == input;
ItemStack stack = new ItemStack(state.getBlock(), 1, state.getBlock().damageDropped(state));
String oredict = (String) input;
return isOreDict(stack, oredict);
@@ -88,7 +91,7 @@ public class RecipePureDaisy {
*/
public boolean set(World world, BlockPos pos, SubTileEntity pureDaisy) {
if(!world.isRemote)
world.setBlockState(pos, outputState, 1 | 2);
world.setBlockState(pos, outputState);
return true;
}
@@ -8,12 +8,10 @@
*/
package vazkii.botania.client.integration.jei;
import mezz.jei.api.IJeiRuntime;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.ISubtypeRegistry;
import mezz.jei.api.JEIPlugin;
import mezz.jei.api.ingredients.IModIngredientRegistration;
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import net.minecraft.item.Item;
@@ -55,9 +53,6 @@ public class JEIBotaniaPlugin implements IModPlugin {
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ModBlocks.floatingSpecialFlower), ItemBlockSpecialFlower::getType);
}
@Override
public void registerIngredients(@Nonnull IModIngredientRegistration registry) {}
@Override
public void registerCategories(IRecipeCategoryRegistration registry) {
registry.addRecipeCategories(
@@ -109,7 +104,4 @@ public class JEIBotaniaPlugin implements IModPlugin {
registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerCraftingHalo.class, VanillaRecipeCategoryUid.CRAFTING, 1, 9, 10, 36);
}
@Override
public void onRuntimeAvailable(@Nonnull IJeiRuntime jeiRuntime) {}
}
@@ -62,16 +62,6 @@ public class BreweryRecipeCategory implements IRecipeCategory {
return background;
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
if(!(recipeWrapper instanceof BreweryRecipeWrapper))
@@ -94,10 +84,4 @@ public class BreweryRecipeCategory implements IRecipeCategory {
recipeLayout.getItemStacks().init(7, false, 87, 41);
recipeLayout.getItemStacks().set(7, ingredients.getOutputs(ItemStack.class).get(0));
}
@Override
public List getTooltipStrings(int mouseX, int mouseY) {
return new ArrayList();
}
}
@@ -47,21 +47,4 @@ public class BreweryRecipeWrapper implements IRecipeWrapper {
ingredients.setInputLists(ItemStack.class, input);
ingredients.setOutputLists(ItemStack.class, ImmutableList.of(output));
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
}
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
}
@Override
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) {
return false;
}
}
@@ -64,12 +64,6 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
return background;
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
@@ -114,11 +108,6 @@ public class ElvenTradeRecipeCategory implements IRecipeCategory {
}
}
@Override
public List getTooltipStrings(int mouseX, int mouseY) {
return new ArrayList();
}
@Nonnull
@Override
public String getModName() {
@@ -44,19 +44,4 @@ public class ElvenTradeRecipeWrapper implements IRecipeWrapper {
ingredients.setInputLists(ItemStack.class, input);
ingredients.setOutputs(ItemStack.class, outputs);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {}
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
}
@Override
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) {
return false;
}
}
@@ -61,12 +61,6 @@ public class PetalApothecaryRecipeCategory implements IRecipeCategory {
return background;
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
@@ -106,11 +100,6 @@ public class PetalApothecaryRecipeCategory implements IRecipeCategory {
return new Point((int) newX, (int) newY);
}
@Override
public List getTooltipStrings(int mouseX, int mouseY) {
return new ArrayList();
}
@Nonnull
@Override
public String getModName() {
@@ -44,19 +44,4 @@ public class PetalApothecaryRecipeWrapper implements IRecipeWrapper {
ingredients.setOutput(ItemStack.class, output);
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
}
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
}
@Override
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) {
return false;
}
}
@@ -61,12 +61,6 @@ public class PureDaisyRecipeCategory implements IRecipeCategory {
return background;
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
@@ -104,11 +98,6 @@ public class PureDaisyRecipeCategory implements IRecipeCategory {
}
}
@Override
public List getTooltipStrings(int mouseX, int mouseY) {
return new ArrayList();
}
@Nonnull
@Override
public String getModName() {
@@ -12,6 +12,7 @@ import com.google.common.collect.ImmutableList;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidRegistry;
@@ -32,12 +33,14 @@ public class PureDaisyRecipeWrapper implements IRecipeWrapper {
public PureDaisyRecipeWrapper(RecipePureDaisy recipe) {
if(recipe.getInput() instanceof String) {
inputs = ImmutableList.copyOf(OreDictionary.getOres((String) recipe.getInput()));
} else if(recipe.getInput() instanceof Block) {
Block b = (Block) recipe.getInput();
} else if(recipe.getInput() instanceof Block || recipe.getInput() instanceof IBlockState) {
IBlockState state = recipe.getInput() instanceof IBlockState ? (IBlockState) recipe.getInput() : ((Block) recipe.getInput()).getDefaultState();
Block b = state.getBlock();
if(FluidRegistry.lookupFluidForBlock(b) != null) {
fluidInput = new FluidStack(FluidRegistry.lookupFluidForBlock(b), 1000);
} else {
inputs = ImmutableList.of(new ItemStack(b, 1, b.getMetaFromState(b.getDefaultState())));
inputs = ImmutableList.of(new ItemStack(b, 1, b.getMetaFromState(state)));
}
}
@@ -66,19 +69,4 @@ public class PureDaisyRecipeWrapper implements IRecipeWrapper {
}
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
}
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
}
@Override
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) {
return false;
}
}
@@ -60,12 +60,6 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
return background;
}
@Nullable
@Override
public IDrawable getIcon() {
return null;
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
@@ -107,11 +101,6 @@ public class RunicAltarRecipeCategory implements IRecipeCategory {
return new Point((int) newX, (int) newY);
}
@Override
public List getTooltipStrings(int mouseX, int mouseY) {
return new ArrayList();
}
@Nonnull
@Override
public String getModName() {
@@ -57,15 +57,4 @@ public class RunicAltarRecipeWrapper implements IRecipeWrapper {
GlStateManager.disableAlpha();
}
@Nonnull
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY) {
return ImmutableList.of();
}
@Override
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton) {
return false;
}
}
@@ -150,6 +150,15 @@ public class BlockAnimatedTorch extends BlockMod implements IWandable, IManaTrig
return BlockFaceShape.UNDEFINED;
}
@Override
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) {
// TE is already gone so best we can do is just notify everyone
for(EnumFacing side : EnumFacing.VALUES) {
world.notifyNeighborsOfStateChange(pos.offset(side), this, false);
}
super.onBlockDestroyedByPlayer(world, pos, state);
}
@Override
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
return LexiconData.animatedTorch;
@@ -10,39 +10,26 @@
*/
package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.block.tile.TileBifrost;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
import java.util.Random;
public class BlockBifrost extends BlockMod implements ILexiconable {
public class BlockBifrost extends BlockBifrostPerm implements ILexiconable {
public BlockBifrost() {
super(Material.GLASS, LibBlockNames.BIFROST);
setLightOpacity(0);
setLightLevel(1F);
super(LibBlockNames.BIFROST);
setBlockUnbreakable();
setSoundType(SoundType.GLASS);
}
@Override
@@ -50,30 +37,12 @@ public class BlockBifrost extends BlockMod implements ILexiconable {
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Nonnull
@Override
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
return new ItemStack(ModItems.rainbowRod);
}
@Override
public boolean shouldSideBeRendered(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, EnumFacing side) {
Block block = world.getBlockState(pos.offset(side)).getBlock();
return block != this && super.shouldSideBeRendered(state, world, pos, side);
}
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@Override
public int quantityDropped(IBlockState state, int fortune, @Nonnull Random random) {
return 0;
@@ -89,10 +58,4 @@ public class BlockBifrost extends BlockMod implements ILexiconable {
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
return new TileBifrost();
}
@Override
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
return LexiconData.rainbowRod;
}
}
@@ -34,12 +34,15 @@ import java.util.Random;
public class BlockBifrostPerm extends BlockMod implements ILexiconable {
public BlockBifrostPerm() {
super(Material.GLASS, LibBlockNames.BIFROST_PERM);
setLightOpacity(0);
this(LibBlockNames.BIFROST_PERM);
setHardness(0.3F);
}
public BlockBifrostPerm(String name) {
super(Material.GLASS, name);
setLightOpacity(0);
setLightLevel(1F);
setSoundType(SoundType.GLASS);
setTickRandomly(true);
}
@Override
@@ -48,8 +51,8 @@ public class BlockBifrostPerm extends BlockMod implements ILexiconable {
}
@Override
public boolean isFullBlock(IBlockState state) {
return true;
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
@@ -51,6 +51,6 @@ public abstract class BlockMod extends Block implements IModelRegister {
public boolean eventReceived(IBlockState state, World world, BlockPos pos, int id, int param) {
super.eventReceived(state, world, pos, id, param);
TileEntity tileentity = world.getTileEntity(pos);
return tileentity != null ? tileentity.receiveClientEvent(id, param) : false;
return tileentity != null && tileentity.receiveClientEvent(id, param);
}
}
@@ -209,11 +209,7 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
@Override
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
TilePool pool = (TilePool) world.getTileEntity(pos);
int val = (int) ((double) pool.getCurrentMana() / (double) pool.manaCap * 15.0);
if(pool.getCurrentMana() > 0)
val = Math.max(val, 1);
return val;
return TilePool.calculateComparatorLevel(pool.getCurrentMana(), pool.manaCap);
}
@Override
@@ -19,27 +19,44 @@ import vazkii.botania.common.Botania;
import vazkii.botania.common.lexicon.LexiconData;
public class SubTileManastar extends SubTileEntity {
private static final int SET_STATE_EVENT = 0;
private static final int NONE = 0, DECREASING = 1, INCREASING = 2;
int manaLastTick = -1;
private int lastMana = 0;
private int state = NONE;
@Override
public void onUpdate() {
super.onUpdate();
int mana = 0;
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
TileEntity tile = supertile.getWorld().getTileEntity(supertile.getPos().offset(dir));
if(tile instanceof IManaPool)
mana += ((IManaPool) tile).getCurrentMana();
}
if(getWorld().isRemote) {
if(state != NONE && Math.random() > 0.6)
Botania.proxy.wispFX(supertile.getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, supertile.getPos().getY() + 0.75 + Math.random() * 0.2 - 0.1, supertile.getPos().getZ() + 0.5, state == INCREASING ? 0.05F : 1F, 0.05F, state == INCREASING ? 1F : 0.05F, (float) Math.random() / 7, (float) -Math.random() / 50);
} else {
int mana = 0;
for(EnumFacing dir : EnumFacing.HORIZONTALS) {
TileEntity tile = supertile.getWorld().getTileEntity(supertile.getPos().offset(dir));
if(tile instanceof IManaPool)
mana += ((IManaPool) tile).getCurrentMana();
}
if(manaLastTick != -1 && mana != manaLastTick && Math.random() > 0.6) {
boolean more = mana > manaLastTick;
Botania.proxy.wispFX(supertile.getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, supertile.getPos().getY() + 0.75 + Math.random() * 0.2 - 0.1, supertile.getPos().getZ() + 0.5, more ? 0.05F : 1F, 0.05F, more ? 1F : 0.05F, (float) Math.random() / 7, (float) -Math.random() / 50);
}
int newState = mana > lastMana ? INCREASING : mana < lastMana ? DECREASING : NONE;
if(newState != state)
getWorld().addBlockEvent(getPos(), supertile.getBlockType(), SET_STATE_EVENT, newState);
if(ticksExisted % 60 == 0)
manaLastTick = mana;
if(ticksExisted % 60 == 0)
lastMana = mana;
}
}
@Override
public boolean receiveClientEvent(int id, int param) {
if(id == SET_STATE_EVENT) {
state = param;
return true;
} else {
return super.receiveClientEvent(id, param);
}
}
@Override
@@ -129,10 +129,10 @@ public class SubTileLoonuim extends SubTileFunctional {
map.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier("Loonium Modififer Health", 2, 1));
map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier("Loonium Modififer Damage", 1.5, 1));
entity.getAttributeMap().applyAttributeModifiers(map);
entity.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, Integer.MAX_VALUE, 0));
entity.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, Integer.MAX_VALUE, 0));
entity.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, entity instanceof EntityCreeper ? 100 : Integer.MAX_VALUE, 0));
entity.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, entity instanceof EntityCreeper ? 100 : Integer.MAX_VALUE, 0));
NBTTagCompound cmp = stack.writeToNBT(new NBTTagCompound());
entity.getEntityData().setTag(TAG_ITEMSTACK_TO_DROP, cmp);
@@ -10,13 +10,16 @@
*/
package vazkii.botania.common.block.subtile.generating;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileGenerating;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.network.PacketBotaniaEffect;
import vazkii.botania.common.network.PacketHandler;
@@ -26,6 +29,7 @@ import java.util.List;
public class SubTileEntropinnyum extends SubTileGenerating {
private static final int RANGE = 12;
private static final int EXPLODE_EFFECT_EVENT = 0;
@Override
public void onUpdate() {
@@ -40,12 +44,29 @@ public class SubTileEntropinnyum extends SubTileGenerating {
mana += getMaxMana();
sync();
PacketHandler.sendToNearby(supertile.getWorld(), supertile.getPos(), new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.ENTROPINNYUM, tnt.posX, tnt.posY, tnt.posZ));
getWorld().addBlockEvent(getPos(), supertile.getBlockType(), EXPLODE_EFFECT_EVENT, tnt.getEntityId());
}
}
}
}
@Override
public boolean receiveClientEvent(int event, int param) {
if(event == EXPLODE_EFFECT_EVENT) {
if(getWorld().isRemote && getWorld().getEntityByID(param) instanceof EntityTNTPrimed) {
Entity e = getWorld().getEntityByID(param);
for(int i = 0; i < 50; i++)
Botania.proxy.sparkleFX(e.posX + Math.random() * 4 - 2, e.posY + Math.random() * 4 - 2, e.posZ + Math.random() * 4 - 2, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, (float) (Math.random() * 0.65F + 1.25F), 12);
getWorld().spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, e.posX, e.posY, e.posZ, 1D, 0D, 0D);
}
return true;
} else {
return super.receiveClientEvent(event, param);
}
}
@Override
public int getColor() {
return 0xcb0000;
@@ -17,6 +17,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
@@ -44,7 +45,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
public class TileAlfPortal extends TileMod {
public class TileAlfPortal extends TileMod implements ITickable {
private static final BlockPos[] LIVINGWOOD_POSITIONS = {
new BlockPos(-1, 0, 0), new BlockPos(1, 0, 0), new BlockPos(-2, 1, 0),
@@ -27,6 +27,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.fluids.Fluid;
@@ -60,10 +61,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
public class TileAltar extends TileSimpleInventory implements IPetalApothecary, ITickable {
private static final Pattern SEED_PATTERN = Pattern.compile("(?:(?:(?:[A-Z-_.:]|^)seed)|(?:(?:[a-z-_.:]|^)Seed))(?:[sA-Z-_.:]|$)");
private static final int SET_KEEP_TICKS_EVENT = 0;
private static final int CRAFT_EFFECT_EVENT = 1;
public static final String TAG_HAS_WATER = "hasWater";
public static final String TAG_HAS_LAVA = "hasLava";
@@ -153,7 +155,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
setWater(false);
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
craftingFanciness();
world.addBlockEvent(getPos(), getBlockType(), CRAFT_EFFECT_EVENT, 0);
didChange = true;
break;
@@ -225,12 +227,6 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
}
}
private void craftingFanciness() {
world.playSound(null, pos, ModSounds.altarCraft, SoundCategory.BLOCKS, 1F, 1F);
PacketHandler.sendToNearby(world, getPos(),
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.APOTHECARY_CRAFT, getPos().getX(), getPos().getY(), getPos().getZ()));
}
public boolean isEmpty() {
for(int i = 0; i < getSizeInventory(); i++)
if(!itemHandler.getStackInSlot(i).isEmpty())
@@ -308,11 +304,21 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
@Override
public boolean receiveClientEvent(int id, int param) {
if(id == SET_KEEP_TICKS_EVENT) {
recipeKeepTicks = param;
return true;
} else {
return false;
switch(id) {
case SET_KEEP_TICKS_EVENT: recipeKeepTicks = param; return true;
case CRAFT_EFFECT_EVENT: {
if(world.isRemote) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(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);
}
world.playSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.altarCraft, SoundCategory.BLOCKS, 1F, 1F, false);
}
return true;
}
default: return super.receiveClientEvent(id, param);
}
}
@@ -18,6 +18,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ITickable;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -26,7 +27,7 @@ import vazkii.botania.common.block.ModBlocks;
import java.util.Arrays;
public class TileAnimatedTorch extends TileMod {
public class TileAnimatedTorch extends TileMod implements ITickable {
public static final String TAG_SIDE = "side";
public static final String TAG_ROTATING = "rotating";
@@ -69,6 +70,7 @@ public class TileAnimatedTorch extends TileMod {
if(entity != null) {
side = Arrays.asList(SIDES).indexOf(entity.getHorizontalFacing().getOpposite());
}
world.notifyNeighborsOfStateChange(getPos().offset(SIDES[side].getOpposite()), getBlockType(), false);
}
public void toggle() {
@@ -112,7 +114,11 @@ public class TileAnimatedTorch extends TileMod {
this.side = side;
rotating = true;
// tell neighbors that signal is off because we are rotating
world.notifyNeighborsOfStateChange(getPos(), getBlockType(), false);
for(EnumFacing e : EnumFacing.VALUES) {
world.notifyNeighborsOfStateChange(getPos().offset(e), getBlockType(), false);
}
}
@SideOnly(Side.CLIENT)
@@ -133,18 +139,24 @@ public class TileAnimatedTorch extends TileMod {
if(rotationTicks <= 0) {
rotating = false;
// done rotating, tell neighbors
world.notifyNeighborsOfStateChange(getPos(), getBlockType(), false);
for(EnumFacing e : EnumFacing.VALUES) {
world.notifyNeighborsOfStateChange(getPos().offset(e), getBlockType(), false);
}
}
} else rotation = side * 90;
int amt = rotating ? 3 : Math.random() < 0.1 ? 1 : 0;
double x = getPos().getX() + 0.5 + Math.cos((rotation + 90) / 180.0 * Math.PI) * 0.35;
double y = getPos().getY() + 0.2;
double z = getPos().getZ() + 0.5 + Math.sin((rotation + 90) / 180.0 * Math.PI) * 0.35;
if(world.isRemote) {
int amt = rotating ? 3 : Math.random() < 0.1 ? 1 : 0;
double x = getPos().getX() + 0.5 + Math.cos((rotation + 90) / 180.0 * Math.PI) * 0.35;
double y = getPos().getY() + 0.2;
double z = getPos().getZ() + 0.5 + Math.sin((rotation + 90) / 180.0 * Math.PI) * 0.35;
for(int i = 0; i < amt; i++)
world.spawnParticle(EnumParticleTypes.REDSTONE, x, y, z, 0.0D, 0.0D, 0.0D, new int[0]);
for(int i = 0; i < amt; i++)
world.spawnParticle(EnumParticleTypes.REDSTONE, x, y, z, 0.0D, 0.0D, 0.0D);
}
}
@Override
@@ -171,18 +183,18 @@ public class TileAnimatedTorch extends TileMod {
torchMode = modes[modeOrdinal % modes.length];
}
public static enum TorchMode {
public enum TorchMode {
TOGGLE((t, i) -> (i + 2) % 4),
ROTATE((t, i) -> (i + 1) % 4),
RANDOM((t, i) -> t.currentRandomRotation);
private TorchMode(RotationHandler modeSwitcher) {
TorchMode(RotationHandler modeSwitcher) {
this.modeSwitcher = modeSwitcher;
}
public final RotationHandler modeSwitcher;
private static interface RotationHandler {
private interface RotationHandler {
int rotate(TileAnimatedTorch tile, int curr);
}
}
@@ -13,6 +13,7 @@ package vazkii.botania.common.block.tile;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraftforge.items.IItemHandler;
import vazkii.botania.api.item.IAvatarTile;
import vazkii.botania.api.item.IAvatarWieldable;
@@ -20,7 +21,7 @@ import vazkii.botania.api.state.BotaniaStateProps;
import javax.annotation.Nonnull;
public class TileAvatar extends TileSimpleInventory implements IAvatarTile {
public class TileAvatar extends TileSimpleInventory implements IAvatarTile, ITickable {
private static final int MAX_MANA = 6400;
@@ -11,11 +11,12 @@
package vazkii.botania.common.block.tile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ITickable;
import vazkii.botania.common.Botania;
import javax.annotation.Nonnull;
public class TileBifrost extends TileMod {
public class TileBifrost extends TileMod implements ITickable {
private static final String TAG_TICKS = "ticks";
@@ -27,8 +28,7 @@ public class TileBifrost extends TileMod {
if(ticks <= 0) {
world.setBlockToAir(pos);
} else ticks--;
} else if(Math.random() < 0.1)
Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
}
}
@Nonnull
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import vazkii.botania.api.BotaniaAPI;
@@ -38,10 +39,10 @@ import javax.annotation.Nullable;
import java.awt.Color;
import java.util.List;
// This is mostly copypasta from TileRuneAltar
public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
public class TileBrewery extends TileSimpleInventory implements IManaReceiver, ITickable {
private static final String TAG_MANA = "mana";
private static final int CRAFT_EFFECT_EVENT = 0;
public RecipeBrew recipe;
int mana = 0;
@@ -129,16 +130,14 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
if(mana >= getManaCost() && !world.isRemote) {
int mana = getManaCost();
recieveMana(-mana);
if(!world.isRemote) {
ItemStack output = recipe.getOutput(itemHandler.getStackInSlot(0));
EntityItem outputItem = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
world.spawnEntity(outputItem);
}
ItemStack output = recipe.getOutput(itemHandler.getStackInSlot(0));
EntityItem outputItem = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
world.spawnEntity(outputItem);
world.addBlockEvent(getPos(), ModBlocks.brewery, CRAFT_EFFECT_EVENT, recipe.getBrew().getColor(output));
for(int i = 0; i < getSizeInventory(); i++)
itemHandler.setStackInSlot(i, ItemStack.EMPTY);
craftingFanciness();
}
}
}
@@ -155,6 +154,27 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
manaLastTick = mana;
}
@Override
public boolean receiveClientEvent(int event, int param) {
if(event == CRAFT_EFFECT_EVENT) {
if(world.isRemote) {
for(int i = 0; i < 25; i++) {
Color c = new Color(param);
float r = c.getRed() / 255F;
float g = c.getGreen() / 255F;
float b = c.getBlue() / 255F;
Botania.proxy.sparkleFX(pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, r, g, b, (float) Math.random() * 2F + 0.5F, 10);
for(int j = 0; j < 2; j++)
Botania.proxy.wispFX(pos.getX() + 0.7 - Math.random() * 0.4, pos.getY() + 0.9 - Math.random() * 0.2, pos.getZ() + 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);
}
world.playSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.potionCreate, SoundCategory.BLOCKS, 1F, 1.5F + (float) Math.random() * 0.25F, false);
}
return true;
} else {
return super.receiveClientEvent(event, param);
}
}
public int getManaCost() {
ItemStack stack = itemHandler.getStackInSlot(0);
if(recipe == null || stack.isEmpty() || !(stack.getItem() instanceof IBrewContainer))
@@ -163,11 +183,6 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
return container.getManaCost(recipe.getBrew(), stack);
}
public void craftingFanciness() {
world.playSound(null, pos, ModSounds.potionCreate, SoundCategory.BLOCKS, 1F, 1.5F + (float) Math.random() * 0.25F);
PacketHandler.sendToNearby(world, pos, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.BREWERY_FINISH, pos.getX(), pos.getY(), pos.getZ(), recipe.getBrew().getColor(itemHandler.getStackInSlot(0))));
}
@Override
public void writePacketNBT(NBTTagCompound par1nbtTagCompound) {
super.writePacketNBT(par1nbtTagCompound);
@@ -24,9 +24,10 @@ import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ITickable;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
public class TileCocoon extends TileMod {
public class TileCocoon extends TileMod implements ITickable{
private static final String TAG_TIME_PASSED = "timePassed";
private static final String TAG_EMERALDS_GIVEN = "emeraldsGiven";
@@ -27,6 +27,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@@ -42,6 +43,7 @@ import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkHelper;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.network.PacketBotaniaEffect;
@@ -54,7 +56,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class TileEnchanter extends TileMod implements ISparkAttachable {
public class TileEnchanter extends TileMod implements ISparkAttachable, ITickable {
private static final String TAG_STAGE = "stage";
private static final String TAG_STAGE_TICKS = "stageTicks";
@@ -63,6 +65,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
private static final String TAG_MANA = "mana";
private static final String TAG_ITEM = "item";
private static final String TAG_ENCHANTS = "enchantsToApply";
private static final int CRAFT_EFFECT_EVENT = 0;
public State stage = State.IDLE;
public int stageTicks = 0;
@@ -246,7 +249,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
manaRequired = -1;
mana = 0;
craftingFanciness();
world.addBlockEvent(getPos(), ModBlocks.enchanter, CRAFT_EFFECT_EVENT, 0);
advanceStage();
}
break;
@@ -282,10 +285,25 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
sync();
}
private void craftingFanciness() {
world.playSound(null, pos, ModSounds.enchanterEnchant, SoundCategory.BLOCKS, 1F, 1F);
PacketHandler.sendToNearby(world, pos,
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.ENCHANTER_CRAFT, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5));
@Override
public boolean receiveClientEvent(int event, int param) {
switch(event) {
case CRAFT_EFFECT_EVENT: {
if(world.isRemote) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(
getPos().getX() + Math.random() * 0.4 - 0.2, getPos().getY(), getPos().getZ() + Math.random() * 0.4 - 0.2,
red, green, blue, (float) Math.random(), 10);
}
world.playSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.enchanterEnchant, SoundCategory.BLOCKS, 1F, 1F, false);
}
return true;
}
default: return super.receiveClientEvent(event, param);
}
}
@Nonnull
@@ -16,6 +16,7 @@ import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.WorldServer;
@@ -24,7 +25,7 @@ import vazkii.botania.common.item.equipment.tool.ToolCommons;
import java.util.List;
public class TileEnderEye extends TileMod {
public class TileEnderEye extends TileMod implements ITickable {
@Override
public void update() {
@@ -11,9 +11,10 @@
package vazkii.botania.common.block.tile;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
public class TileForestEye extends TileMod {
public class TileForestEye extends TileMod implements ITickable {
public int entities = 0;
@@ -21,6 +21,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.ITickable;
import net.minecraft.util.StringUtils;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
@@ -32,7 +33,7 @@ import vazkii.botania.common.item.ModItems;
import javax.annotation.Nonnull;
public class TileHourglass extends TileSimpleInventory {
public class TileHourglass extends TileSimpleInventory implements ITickable {
private static final String TAG_TIME = "time";
private static final String TAG_TIME_FRACTION = "timeFraction";
@@ -16,6 +16,7 @@ import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import vazkii.botania.api.BotaniaAPI;
@@ -29,7 +30,7 @@ import javax.annotation.Nonnull;
import java.awt.Color;
import java.util.List;
public class TileIncensePlate extends TileSimpleInventory {
public class TileIncensePlate extends TileSimpleInventory implements ITickable {
private static final String TAG_TIME_LEFT = "timeLeft";
private static final String TAG_BURNING = "burning";
@@ -33,6 +33,7 @@ import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@@ -49,7 +50,7 @@ import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.lib.LibMisc;
public class TileLightRelay extends TileMod implements IWandBindable {
public class TileLightRelay extends TileMod implements ITickable, IWandBindable {
private static final int MAX_DIST = 20;
@@ -11,9 +11,10 @@
package vazkii.botania.common.block.tile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ITickable;
import vazkii.botania.common.Botania;
public class TileManaFlame extends TileMod {
public class TileManaFlame extends TileMod implements ITickable {
private static final String TAG_COLOR = "color";
@@ -15,13 +15,12 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class TileMod extends TileEntity implements ITickable {
public class TileMod extends TileEntity {
@Override
public boolean shouldRefresh(World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState) {
@@ -65,7 +64,4 @@ public class TileMod extends TileEntity implements ITickable {
readPacketNBT(packet.getNbtCompound());
}
@Override
public void update() {}
}
@@ -16,6 +16,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import vazkii.botania.api.state.BotaniaStateProps;
@@ -23,7 +24,7 @@ import vazkii.botania.common.block.ModBlocks;
import javax.annotation.Nonnull;
public class TileOpenCrate extends TileSimpleInventory {
public class TileOpenCrate extends TileSimpleInventory implements ITickable {
@Override
public boolean shouldRefresh(World world, BlockPos pos, @Nonnull IBlockState oldState, @Nonnull IBlockState newState) {
@@ -20,6 +20,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import org.lwjgl.opengl.GL11;
@@ -43,12 +44,13 @@ import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver {
public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver, ITickable {
private static final String TAG_MANA = "mana";
private static final String TAG_MANA_TO_GET = "manaToGet";
private static final int SET_KEEP_TICKS_EVENT = 0;
private static final int SET_COOLDOWN_EVENT = 1;
private static final int CRAFT_EFFECT_EVENT = 2;
RecipeRuneAltar currentRecipe;
@@ -106,6 +108,18 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
switch (id) {
case SET_KEEP_TICKS_EVENT: recipeKeepTicks = param; return true;
case SET_COOLDOWN_EVENT: cooldown = param; return true;
case CRAFT_EFFECT_EVENT: {
if(world.isRemote) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(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);
}
world.playSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.runeAltarCraft, SoundCategory.BLOCKS, 1, 1, false);
}
return true;
}
default: return super.receiveClientEvent(id, param);
}
}
@@ -239,6 +253,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
world.spawnEntity(outputItem);
currentRecipe = null;
world.addBlockEvent(getPos(), ModBlocks.runeAltar, SET_COOLDOWN_EVENT, 60);
world.addBlockEvent(getPos(), ModBlocks.runeAltar, CRAFT_EFFECT_EVENT, 0);
saveLastRecipe();
for(int i = 0; i < getSizeInventory(); i++) {
@@ -254,18 +269,10 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
}
livingrock.getItem().shrink(1);
craftingFanciness();
}
}
}
public void craftingFanciness() {
world.playSound(null, pos, ModSounds.runeAltarCraft, SoundCategory.BLOCKS, 1, 1);
PacketHandler.sendToNearby(world, getPos(),
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.RUNE_CRAFT, getPos().getX(), getPos().getY(), getPos().getZ()));
}
public boolean isEmpty() {
for(int i = 0; i < getSizeInventory(); i++)
if(!itemHandler.getStackInSlot(i).isEmpty())
@@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.MobSpawnerBaseLogic;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.ITickable;
import net.minecraft.util.WeightedSpawnerEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@@ -26,7 +27,7 @@ import net.minecraft.world.chunk.storage.AnvilChunkLoader;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.common.Botania;
public class TileSpawnerClaw extends TileMod implements IManaReceiver {
public class TileSpawnerClaw extends TileMod implements IManaReceiver, ITickable {
private static final String TAG_MANA = "mana";
@@ -23,6 +23,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -37,7 +38,7 @@ import vazkii.botania.common.block.tile.string.TileRedStringRelay;
import java.util.List;
public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTileSlowableContainer {
public class TileSpecialFlower extends TileMod implements IWandBindable, ISubTileSlowableContainer, ITickable {
private static final String TAG_SUBTILE_NAME = "subTileName";
private static final String TAG_SUBTILE_CMP = "subTileCmp";
@@ -10,9 +10,10 @@
*/
package vazkii.botania.common.block.tile;
import net.minecraft.util.ITickable;
import vazkii.botania.common.Botania;
public class TileSpiritShrine extends TileMod {
public class TileSpiritShrine extends TileMod implements ITickable {
int ticks;
@@ -10,10 +10,11 @@
*/
package vazkii.botania.common.block.tile;
import net.minecraft.util.ITickable;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.Botania;
public class TileStarfield extends TileMod {
public class TileStarfield extends TileMod implements ITickable {
@Override
public void update() {
@@ -17,6 +17,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.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@@ -36,7 +37,7 @@ import vazkii.botania.common.network.PacketHandler;
import java.util.List;
public class TileTerraPlate extends TileMod implements ISparkAttachable {
public class TileTerraPlate extends TileMod implements ISparkAttachable, ITickable {
public static final int MAX_MANA = TilePool.MAX_MANA / 2;
@@ -10,9 +10,10 @@
*/
package vazkii.botania.common.block.tile;
import net.minecraft.util.ITickable;
import net.minecraft.world.World;
public class TileTeruTeruBozu extends TileMod {
public class TileTeruTeruBozu extends TileMod implements ITickable {
public boolean wasRaining = false;
@@ -10,9 +10,10 @@
*/
package vazkii.botania.common.block.tile;
import net.minecraft.util.ITickable;
import vazkii.botania.common.item.equipment.bauble.ItemTinyPlanet;
public class TileTinyPlanet extends TileMod {
public class TileTinyPlanet extends TileMod implements ITickable {
@Override
public void update() {
@@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.text.TextComponentString;
@@ -26,7 +27,7 @@ import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.lib.LibMisc;
public class TileTinyPotato extends TileSimpleInventory {
public class TileTinyPotato extends TileSimpleInventory implements ITickable {
private static final String TAG_NAME = "name";
@@ -15,6 +15,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.common.capabilities.Capability;
@@ -30,7 +31,7 @@ import vazkii.botania.api.internal.VanillaPacketDispatcher;
import javax.annotation.Nonnull;
import java.util.List;
public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorporeaRequestor {
public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorporeaRequestor, ITickable {
private static final String TAG_REQUEST_TARGET = "requestTarget";
private static final String TAG_ITEM_COUNT = "itemCount";
@@ -14,6 +14,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.text.Style;
@@ -44,7 +45,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequestor {
public class TileCorporeaIndex extends TileCorporeaBase implements ICorporeaRequestor, ITickable {
public static final double RADIUS = 2.5;
@@ -17,6 +17,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.state.BotaniaStateProps;
@@ -24,7 +25,7 @@ import vazkii.botania.common.block.subtile.functional.SubTileExoflame;
import vazkii.botania.common.block.tile.TileMod;
import vazkii.botania.common.core.handler.ModSounds;
public class TileBellows extends TileMod {
public class TileBellows extends TileMod implements ITickable {
private static final String TAG_ACTIVE = "active";
@@ -12,6 +12,7 @@ package vazkii.botania.common.block.tile.mana;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.api.mana.IManaReceiver;
@@ -20,7 +21,7 @@ import vazkii.botania.common.block.tile.TileMod;
import java.util.ArrayList;
import java.util.List;
public class TileDistributor extends TileMod implements IManaReceiver {
public class TileDistributor extends TileMod implements IManaReceiver, ITickable {
final List<IManaReceiver> validPools = new ArrayList<>();
@@ -12,13 +12,14 @@ package vazkii.botania.common.block.tile.mana;
import com.google.common.base.Predicates;
import net.minecraft.entity.Entity;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.tile.TileMod;
public class TileManaDetector extends TileMod {
public class TileManaDetector extends TileMod implements ITickable {
@Override
public void update() {
@@ -27,6 +27,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@@ -56,6 +57,7 @@ import vazkii.botania.common.block.tile.TileMod;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.handler.ManaNetworkHandler;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.ItemManaTablet;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.network.PacketBotaniaEffect;
@@ -66,7 +68,7 @@ import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAttachable, IThrottledPacket {
public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAttachable, IThrottledPacket, ITickable {
public static final Color PARTICLE_COLOR = new Color(0x00C6FF);
public static final int MAX_MANA = 1000000;
@@ -82,6 +84,8 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
private static final String TAG_FRAGILE = "fragile";
private static final String TAG_INPUT_KEY = "inputKey";
private static final String TAG_OUTPUT_KEY = "outputKey";
private static final int CRAFT_EFFECT_EVENT = 0;
private static final int CHARGE_EFFECT_EVENT = 1;
private boolean outputting = false;
@@ -120,9 +124,12 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
@Override
public void recieveMana(int mana) {
int old = this.mana;
this.mana = Math.max(0, Math.min(getCurrentMana() + mana, manaCap));
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
markDispatchable();
if(old != this.mana) {
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
markDispatchable();
}
}
@Override
@@ -137,6 +144,13 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
ManaNetworkEvent.removePool(this);
}
public static int calculateComparatorLevel(int mana, int max) {
int val = (int) ((double) mana / (double) max * 15.0);
if(mana > 0)
val = Math.max(val, 1);
return val;
}
public static RecipeManaInfusion getMatchingRecipe(@Nonnull ItemStack stack, @Nonnull IBlockState state) {
List<RecipeManaInfusion> matchingNonCatRecipes = new ArrayList<>();
List<RecipeManaInfusion> matchingCatRecipes = new ArrayList<>();
@@ -197,8 +211,39 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
soundTicks = 6;
}
PacketHandler.sendToNearby(world, getPos(),
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.POOL_CRAFT, pos.getX(), pos.getY(), pos.getZ()));
world.addBlockEvent(getPos(), getBlockType(), CRAFT_EFFECT_EVENT, 0);
}
@Override
public boolean receiveClientEvent(int event, int param) {
switch(event) {
case CRAFT_EFFECT_EVENT: {
if(world.isRemote) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 0.75, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2,
red, green, blue, (float) Math.random(), 10);
}
}
return true;
}
case CHARGE_EFFECT_EVENT: {
if(world.isRemote) {
if(ConfigHandler.chargingAnimationEnabled) {
boolean outputting = param == 1;
Vector3 itemVec = Vector3.fromBlockPos(pos).add(0.5, 0.5 + Math.random() * 0.3, 0.5);
Vector3 tileVec = Vector3.fromBlockPos(pos).add(0.2 + Math.random() * 0.6, 0, 0.2 + Math.random() * 0.6);
Botania.proxy.lightningFX(outputting ? tileVec : itemVec,
outputting ? itemVec : tileVec, 80, world.rand.nextLong(), 0x4400799c, 0x4400C6FF);
}
}
return true;
}
default: return super.receiveClientEvent(event, param);
}
}
@Override
@@ -270,8 +315,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
if(didSomething) {
if(ConfigHandler.chargingAnimationEnabled && world.rand.nextInt(20) == 0) {
PacketHandler.sendToNearby(world, getPos(),
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.POOL_CHARGE, getPos().getX(), getPos().getY(), getPos().getZ(), outputting ? 1 : 0));
world.addBlockEvent(getPos(), getBlockType(), CHARGE_EFFECT_EVENT, outputting ? 1 : 0);
}
isDoingTransfer = outputting;
}
@@ -14,6 +14,7 @@ import com.google.common.collect.ImmutableMap;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ITickable;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.common.animation.TimeValues;
@@ -27,7 +28,7 @@ import vazkii.botania.common.block.tile.TileMod;
import javax.annotation.Nonnull;
public class TilePump extends TileMod {
public class TilePump extends TileMod implements ITickable {
private static final String TAG_ACTIVE = "active";
@@ -13,6 +13,7 @@ package vazkii.botania.common.block.tile.mana;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.energy.CapabilityEnergy;
@@ -23,7 +24,7 @@ import vazkii.botania.common.block.tile.TileMod;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class TileRFGenerator extends TileMod implements IManaReceiver {
public class TileRFGenerator extends TileMod implements IManaReceiver, ITickable {
private static final int MANA_TO_FE = 10;
private static final int MAX_ENERGY = 1280 * MANA_TO_FE;
@@ -18,12 +18,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.common.block.tile.TileMod;
public class TileTurntable extends TileMod {
public class TileTurntable extends TileMod implements ITickable {
private static final String TAG_SPEED = "speed";
private static final String TAG_BACKWARDS = "backwards";
@@ -15,6 +15,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import vazkii.botania.api.state.BotaniaStateProps;
@@ -23,7 +24,7 @@ import vazkii.botania.common.block.tile.TileMod;
import javax.annotation.Nonnull;
public abstract class TileRedString extends TileMod implements ITileBound {
public abstract class TileRedString extends TileMod implements ITileBound, ITickable {
private BlockPos binding;
@@ -179,7 +179,7 @@ public class EntityPoolMinecart extends EntityMinecart {
if(can) {
pump.hasCartOnTop = true;
pump.comparator = (int) ((double) getMana() / (double) TilePool.MAX_MANA * 15);
pump.comparator = (int) ((double) getMana() / (double) TilePool.MAX_MANA * 15); // different from TilePool.calculateComparatorLevel, kept for compatibility
}
}
@@ -199,6 +199,11 @@ public class EntityPoolMinecart extends EntityMinecart {
setMana(cmp.getInteger(TAG_MANA));
}
@Override
public int getComparatorLevel() {
return TilePool.calculateComparatorLevel(getMana(), TilePool.MAX_MANA);
}
public int getMana() {
return dataManager.get(MANA);
}
@@ -58,9 +58,9 @@ public class ItemBlackLotus extends ItemMod implements IManaDissolvable {
pool.recieveMana(t2 ? MANA_PER_T2 : MANA_PER);
stack.shrink(1);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(item.world, tile.getPos());
PacketHandler.sendToNearby(item.world, item, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.BLACK_LOTUS_DISSOLVE, item.posX, tile.getPos().getY() + 0.5, item.posZ));
}
PacketHandler.sendToNearby(item.world, item, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.BLACK_LOTUS_DISSOLVE, item.posX, tile.getPos().getY() + 0.5, item.posZ));
item.playSound(ModSounds.blackLotus, 0.5F, t2 ? 0.1F : 1F);
}
@@ -102,7 +102,7 @@ public class ItemBloodPendant extends ItemBauble implements IBrewContainer, IBre
if(ManaItemHandler.requestManaExact(stack, eplayer, (int) Math.ceil(cost), false)) {
PotionEffect currentEffect = player.getActivePotionEffect(effect.getPotion());
boolean nightVision = effect.getPotion() == MobEffects.NIGHT_VISION;
if(currentEffect == null || currentEffect.getDuration() < (nightVision ? 205 : 3)) {
if(currentEffect == null || currentEffect.getDuration() < (nightVision ? 205 : 10)) {
PotionEffect applyEffect = new PotionEffect(effect.getPotion(), nightVision ? 285 : 80, effect.getAmplifier(), true, true);
player.addPotionEffect(applyEffect);
}
@@ -1125,8 +1125,8 @@ public final class LexiconData {
luminizerTransport.setLexiconPages(new PageText("0"), new PageText("1"),
new PageCraftingRecipe("2", ModCraftingRecipes.recipeLuminizer), new PageText("3"),
new PageCraftingRecipe("4", ModCraftingRecipes.recipeDetectorLuminizer), new PageText("7"),
new PageCraftingRecipe("8", ModCraftingRecipes.recipeToggleLuminizer), new PageText("9"), new PageText("10"),
new PageCraftingRecipe("11", ModCraftingRecipes.recipeForkLuminizer), new PageText("5"),
new PageCraftingRecipe("8", ModCraftingRecipes.recipeForkLuminizer), new PageText("9"), new PageText("10"),
new PageCraftingRecipe("11", ModCraftingRecipes.recipeToggleLuminizer), new PageText("5"),
new PageCraftingRecipe("6", ModCraftingRecipes.recipeLuminizerLauncher));
starSword = new AlfheimLexiconEntry(LibLexicon.ENDER_STAR_SWORD, categoryEnder);
@@ -21,6 +21,8 @@ import vazkii.botania.common.entity.EntityDoppleganger;
import java.awt.Color;
// Prefer using World.addBlockEvent/Block.eventReceived/TileEntity.receiveClientEvent where possible
// as those use less network bandwidth (~14 bytes), vs 26+ bytes here
public class PacketBotaniaEffect implements IMessage {
private EffectType type;
@@ -41,7 +43,7 @@ public class PacketBotaniaEffect implements IMessage {
@Override
public void fromBytes(ByteBuf buf) {
type = EffectType.values()[buf.readShort()];
type = EffectType.values()[buf.readByte()];
x = buf.readDouble();
y = buf.readDouble();
z = buf.readDouble();
@@ -54,7 +56,7 @@ public class PacketBotaniaEffect implements IMessage {
@Override
public void toBytes(ByteBuf buf) {
buf.writeShort(type.ordinal());
buf.writeByte(type.ordinal());
buf.writeDouble(x);
buf.writeDouble(y);
buf.writeDouble(z);
@@ -75,27 +77,6 @@ public class PacketBotaniaEffect implements IMessage {
Minecraft mc = Minecraft.getMinecraft();
World world = mc.world;
switch (message.type) {
case POOL_CRAFT: {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(message.x + 0.5 + Math.random() * 0.4 - 0.2, message.y + 0.75, message.z + 0.5 + Math.random() * 0.4 - 0.2,
red, green, blue, (float) Math.random(), 10);
}
break;
}
case POOL_CHARGE: {
if(ConfigHandler.chargingAnimationEnabled) {
boolean outputting = message.args[0] == 1;
BlockPos pos = new BlockPos(message.x, message.y, message.z);
Vector3 itemVec = Vector3.fromBlockPos(pos).add(0.5, 0.5 + Math.random() * 0.3, 0.5);
Vector3 tileVec = Vector3.fromBlockPos(pos).add(0.2 + Math.random() * 0.6, 0, 0.2 + Math.random() * 0.6);
Botania.proxy.lightningFX(outputting ? tileVec : itemVec,
outputting ? itemVec : tileVec, 80, world.rand.nextLong(), 0x4400799c, 0x4400C6FF);
}
break;
}
case PAINT_LENS: {
EnumDyeColor placeColor = EnumDyeColor.byMetadata(message.args[0]);
int hex = placeColor.getColorValue();
@@ -192,17 +173,6 @@ public class PacketBotaniaEffect implements IMessage {
size, (float) motion.x, (float) motion.y, (float) motion.z);
break;
}
case ENCHANTER_CRAFT: {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(
message.x + Math.random() * 0.4 - 0.2, message.y, message.z + Math.random() * 0.4 - 0.2,
red, green, blue, (float) Math.random(), 10);
}
break;
}
case ENCHANTER_DESTROY: {
for(int i = 0; i < 50; i++) {
float red = (float) Math.random();
@@ -213,13 +183,6 @@ public class PacketBotaniaEffect implements IMessage {
}
break;
}
case ENTROPINNYUM: {
for(int i = 0; i < 50; i++)
Botania.proxy.sparkleFX(message.x + Math.random() * 4 - 2, message.y + Math.random() * 4 - 2, message.z + Math.random() * 4 - 2, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, (float) (Math.random() * 0.65F + 1.25F), 12);
world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, message.x, message.y, message.z, 1D, 0D, 0D);
break;
}
case BLACK_LOTUS_DISSOLVE: {
for(int i = 0; i < 50; i++) {
float r = (float) Math.random() * 0.35F;
@@ -237,17 +200,6 @@ public class PacketBotaniaEffect implements IMessage {
break;
}
case BREWERY_FINISH: {
for(int i = 0; i < 25; i++) {
Color c = new Color(message.args[0]);
float r = c.getRed() / 255F;
float g = c.getGreen() / 255F;
float b = c.getBlue() / 255F;
Botania.proxy.sparkleFX(message.x + 0.5 + Math.random() * 0.4 - 0.2, message.y + 1, message.z + 0.5 + Math.random() * 0.4 - 0.2, r, g, b, (float) Math.random() * 2F + 0.5F, 10);
for(int j = 0; j < 2; j++)
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) {
@@ -280,25 +232,6 @@ public class PacketBotaniaEffect implements IMessage {
}
}
}
case APOTHECARY_CRAFT: {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(message.x + 0.5 + Math.random() * 0.4 - 0.2, message.y + 1, message.z + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
}
break;
}
case RUNE_CRAFT: {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(message.x + 0.5 + Math.random() * 0.4 - 0.2, message.y + 1, message.z + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
}
break;
}
case FLUGEL_EFFECT: {
Entity entity = world.getEntityByID(message.args[0]);
if(entity != null) {
@@ -320,21 +253,14 @@ public class PacketBotaniaEffect implements IMessage {
}
public enum EffectType {
POOL_CRAFT(0),
POOL_CHARGE(1), // Arg: 1 if outputting, 0 if inputting
PAINT_LENS(1), // Arg: EnumDyeColor
ARENA_INDICATOR(0),
ITEM_SMOKE(2), // Arg: Entity ID, number of particles
SPARK_NET_INDICATOR(2), // Arg: Entity ID from, Entity ID towards
SPARK_MANA_FLOW(2), // Arg: Entity ID from, Entity ID towards
ENCHANTER_CRAFT(0),
ENCHANTER_DESTROY(0),
ENTROPINNYUM(0),
BLACK_LOTUS_DISSOLVE(0),
BREWERY_FINISH(1), // Arg: RGB
TERRA_PLATE(0),
APOTHECARY_CRAFT(0),
RUNE_CRAFT(0),
FLUGEL_EFFECT(1); // Arg: Entity ID
private final int argCount;