Merge branch '1.14' into patchouli

This commit is contained in:
Vincent Lee committed 2019-09-24 16:52:33 -05:00
commit 172119701c
130 files changed
+2707 -2352

No files matched your search

@@ -10,6 +10,7 @@
*/
package vazkii.botania.api.lexicon;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
@@ -74,4 +75,14 @@ public class LexiconCategory implements Comparable<LexiconCategory> {
public int compareTo(@Nonnull LexiconCategory category) {
return priority == category.priority ? sortingId - category.sortingId : category.priority - priority;
}
/**
* Determines if the category shows up in the lexicon category index.
* Contained entries will still appear in the lexicon index
* and must be hidden separately if desired.
* @param stack The lexicon stack used by the player
*/
public boolean isVisible(ItemStack stack) {
return true;
}
}
@@ -13,11 +13,9 @@ package vazkii.botania.api.recipe;
import com.google.common.collect.ImmutableList;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.items.IItemHandler;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import java.util.ArrayList;
import java.util.List;
@@ -221,7 +221,7 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, LivingEntity entity, ItemStack stack) {
super.onBlockPlacedBy(world, pos, state, entity, stack);
if(isPassiveFlower()) {
CompoundNBT cmp = stack.getTag();
CompoundNBT cmp = stack.getOrCreateTag();
passiveDecayTicks = cmp.getInt(TAG_PASSIVE_DECAY_TICKS);
}
}
@@ -69,6 +69,9 @@ public final class ContributorFancinessHandler extends LayerRenderer<AbstractCli
@Override
public void render(@Nonnull AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if(player.isInvisible())
return;
String name = player.getDisplayName().getString();
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
@@ -22,10 +22,10 @@ import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.particles.IParticleData;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.client.settings.KeyConflictContext;
import net.minecraftforge.common.MinecraftForge;
@@ -58,7 +58,6 @@ import vazkii.botania.client.core.handler.PersistentVariableHelper;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.fx.FXLightning;
import vazkii.botania.client.fx.FXSparkle;
import vazkii.botania.client.fx.FXWisp;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
import vazkii.botania.client.gui.lexicon.GuiLexiconEntry;
import vazkii.botania.client.gui.lexicon.GuiLexiconIndex;
@@ -261,73 +260,6 @@ public class ClientProxy implements IProxy {
}
}
private static boolean noclipEnabled = false;
private static boolean corruptSparkle = false;
@Override
public void setSparkleFXNoClip(boolean noclip) {
noclipEnabled = noclip;
}
@Override
public void setSparkleFXCorrupt(boolean corrupt) {
corruptSparkle = corrupt;
}
@Override
public void sparkleFX(double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
if(!doParticle() && !fake)
return;
FXSparkle sparkle = new FXSparkle(Minecraft.getInstance().world, x, y, z, size, r, g, b, m);
sparkle.fake = fake;
sparkle.setCanCollide(!fake);
if(noclipEnabled)
sparkle.setCanCollide(false);
if(corruptSparkle)
sparkle.corrupt = true;
Minecraft.getInstance().particles.addEffect(sparkle);
}
private static boolean distanceLimit = true;
private static boolean depthTest = true;
@Override
public void setWispFXDistanceLimit(boolean limit) {
distanceLimit = limit;
}
@Override
public void setWispFXDepthTest(boolean test) {
depthTest = test;
}
@Override
public void wispFX(double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) {
if(!doParticle())
return;
FXWisp wisp = new FXWisp(Minecraft.getInstance().world, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
wisp.setSpeed(motionx, motiony, motionz);
Minecraft.getInstance().particles.addEffect(wisp);
}
private boolean doParticle() {
if(Thread.currentThread().getThreadGroup() == SidedThreadGroups.SERVER)
return false;
if(!ConfigHandler.CLIENT.useVanillaParticleLimiter.get())
return true;
float chance = 1F;
if(Minecraft.getInstance().gameSettings.particles == ParticleStatus.DECREASED)
chance = 0.6F;
else if(Minecraft.getInstance().gameSettings.particles == ParticleStatus.MINIMAL)
chance = 0.2F;
return chance == 1F || Math.random() < chance;
}
@Override
public void lightningFX(Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
Minecraft.getInstance().particles.addEffect(new FXLightning(Minecraft.getInstance().world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner));
@@ -352,5 +284,10 @@ public class ClientProxy implements IProxy {
public BipedModel getEmptyModelBiped() {
return EMPTY_MODEL;
}
@Override
public void addParticleForce(World world, IParticleData particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
world.addParticle(particleData, true, x, y, z, xSpeed, ySpeed, zSpeed);
}
}
@@ -52,13 +52,13 @@ public class FXSparkle extends Particle {
private float f4;
private float f5;
public FXSparkle(World world, double x, double y, double z, float size, float red, float green, float blue, int m) {
public FXSparkle(World world, double x, double y, double z, float size,
float red, float green, float blue, int m,
boolean fake, boolean noClip, boolean corrupt) {
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
particleRed = red;
particleGreen = green;
particleBlue = blue;
particleAlpha = 0.5F; // So MC renders us on the alpha layer, value not actually used
particleGravity = 0;
motionX = motionY = motionZ = 0;
particleScale *= size;
@@ -68,6 +68,9 @@ public class FXSparkle extends Particle {
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
this.fake = fake;
this.corrupt = corrupt;
this.canCollide = !fake && !noClip;
}
public static void dispatchQueuedRenders(Tessellator tessellator) {
@@ -47,14 +47,17 @@ public class FXWisp extends Particle {
private float f4;
private float f5;
public FXWisp(World world, double d, double d1, double d2, float size, float red, float green, float blue, boolean distanceLimit, boolean depthTest, float maxAgeMul) {
super(world, d, d1, d2, 0.0D, 0.0D, 0.0D);
public FXWisp(World world, double d, double d1, double d2, double xSpeed, double ySpeed, double zSpeed,
float size, float red, float green, float blue, boolean depthTest, float maxAgeMul) {
super(world, d, d1, d2, 0, 0, 0);
// super applies wiggle to motion so set it here instead
motionX = xSpeed;
motionY = ySpeed;
motionZ = zSpeed;
particleRed = red;
particleGreen = green;
particleBlue = blue;
particleAlpha = 0.5F; // So MC renders us on the alpha layer, value not actually used
particleGravity = 0;
motionX = motionY = motionZ = 0;
particleScale *= size;
moteParticleScale = particleScale;
maxAge = (int)(28D / (Math.random() * 0.3D + 0.7D) * maxAgeMul);
@@ -64,7 +67,8 @@ public class FXWisp extends Particle {
setSize(0.01F, 0.01F);
Entity renderentity = Minecraft.getInstance().getRenderViewEntity();
if(distanceLimit) {
// todo 1.14
if(false) {
int visibleDistance = 50;
if (!Minecraft.getInstance().gameSettings.fancyGraphics)
visibleDistance = 25;
@@ -0,0 +1,25 @@
package vazkii.botania.client.fx;
import net.minecraft.particles.ParticleType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.lib.LibMisc;
import static vazkii.botania.common.block.ModBlocks.register;
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModParticles {
@ObjectHolder(LibMisc.MOD_ID + ":wisp")
public static ParticleType<WispParticleData> WISP;
@ObjectHolder(LibMisc.MOD_ID + ":sparkle")
public static ParticleType<SparkleParticleData> SPARKLE;
@SubscribeEvent
public static void registerParticles(RegistryEvent.Register<ParticleType<?>> evt) {
register(evt.getRegistry(), new WispParticleType(), "wisp");
register(evt.getRegistry(), new SparkleParticleType(), "sparkle");
}
}
@@ -16,8 +16,14 @@ import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.profiler.IProfiler;
import net.minecraft.profiler.Profiler;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import org.lwjgl.opengl.GL11;
import vazkii.botania.common.lib.LibMisc;
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public final class ParticleRenderDispatcher {
public static int wispFxCount = 0;
@@ -26,6 +32,12 @@ public final class ParticleRenderDispatcher {
public static int fakeSparkleFxCount = 0;
public static int lightningCount = 0;
@SubscribeEvent
public static void registerFactories(ParticleFactoryRegisterEvent evt) {
Minecraft.getInstance().particles.registerFactory(ModParticles.WISP, WispParticleType.FACTORY);
Minecraft.getInstance().particles.registerFactory(ModParticles.SPARKLE, SparkleParticleType.FACTORY);
}
// Called from LightningHandler.onRenderWorldLast since that was
// already registered. /shrug
public static void dispatch() {
@@ -0,0 +1,102 @@
package vazkii.botania.client.fx;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.network.PacketBuffer;
import net.minecraft.particles.IParticleData;
import net.minecraft.particles.ParticleType;
import javax.annotation.Nonnull;
import java.util.Locale;
public class SparkleParticleData implements IParticleData {
public final float size;
public final float r, g, b;
public final int m;
public final boolean noClip;
public final boolean fake;
public final boolean corrupt;
public static SparkleParticleData noClip(float size, float r, float g, float b, int m) {
return new SparkleParticleData(size, r, g, b, m, true, false, false);
}
public static SparkleParticleData fake(float size, float r, float g, float b, int m) {
return new SparkleParticleData(size, r, g, b, m, false, true, false);
}
public static SparkleParticleData corrupt(float size, float r, float g, float b, int m) {
return new SparkleParticleData(size, r, g, b, m, false, false, true);
}
public static SparkleParticleData sparkle(float size, float r, float g, float b, int m) {
return new SparkleParticleData(size, r, g, b, m, false, false, false);
}
private SparkleParticleData(float size, float r, float g, float b, int m, boolean noClip, boolean fake, boolean corrupt) {
this.size = size;
this.r = r;
this.g = g;
this.b = b;
this.m = m;
this.noClip = noClip;
this.fake = fake;
this.corrupt = corrupt;
}
@Nonnull
@Override
public ParticleType<SparkleParticleData> getType() {
return ModParticles.SPARKLE;
}
@Override
public void write(PacketBuffer buf) {
buf.writeFloat(size);
buf.writeFloat(r);
buf.writeFloat(g);
buf.writeFloat(b);
buf.writeInt(m);
buf.writeBoolean(noClip);
buf.writeBoolean(fake);
buf.writeBoolean(corrupt);
}
@Nonnull
@Override
public String getParameters() {
return String.format(Locale.ROOT, "%s %.2f %.2f %.2f %.2f %d %s %s %s",
this.getType().getRegistryName(), this.size, this.r, this.g, this.b, this.m, this.noClip, this.fake, this.corrupt);
}
public static final IDeserializer<SparkleParticleData> DESERIALIZER = new IDeserializer<SparkleParticleData>() {
@Nonnull
@Override
public SparkleParticleData deserialize(@Nonnull ParticleType<SparkleParticleData> type, @Nonnull StringReader reader) throws CommandSyntaxException {
reader.expect(' ');
float size = reader.readFloat();
reader.expect(' ');
float r = reader.readFloat();
reader.expect(' ');
float g = reader.readFloat();
reader.expect(' ');
float b = reader.readFloat();
reader.expect(' ');
int m = reader.readInt();
reader.expect(' ');
boolean noClip = reader.readBoolean();
reader.expect(' ');
boolean fake = reader.readBoolean();
reader.expect(' ');
boolean corrupt = reader.readBoolean();
return new SparkleParticleData(size, r, g, b, m, noClip, fake, corrupt);
}
@Override
public SparkleParticleData read(@Nonnull ParticleType<SparkleParticleData> type, PacketBuffer buf) {
return new SparkleParticleData(buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readInt(), buf.readBoolean(), buf.readBoolean(), buf.readBoolean());
}
};
}
@@ -0,0 +1,14 @@
package vazkii.botania.client.fx;
import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.particles.ParticleType;
public class SparkleParticleType extends ParticleType<SparkleParticleData> {
public SparkleParticleType() {
super(false, SparkleParticleData.DESERIALIZER);
}
public static IParticleFactory<SparkleParticleData> FACTORY =
(data, world, x, y, z, xSpeed, ySpeed, zSpeed)
-> new FXSparkle(world, x, y, z, data.size, data.r, data.g, data.b, data.m, data.fake, data.noClip, data.corrupt);
}
@@ -0,0 +1,94 @@
package vazkii.botania.client.fx;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.network.PacketBuffer;
import net.minecraft.particles.IParticleData;
import net.minecraft.particles.ParticleType;
import javax.annotation.Nonnull;
import java.util.Locale;
public class WispParticleData implements IParticleData {
public final float size;
public final float r, g, b;
public final float maxAgeMul;
public final boolean depthTest;
public static WispParticleData wisp(float size, float r, float g, float b) {
return wisp(size, r, g, b, 1);
}
public static WispParticleData wisp(float size, float r, float g, float b, float maxAgeMul) {
return wisp(size, r, g, b, maxAgeMul, true);
}
public static WispParticleData wisp(float size, float r, float g, float b, boolean depth) {
return wisp(size, r, g, b, 1, depth);
}
public static WispParticleData wisp(float size, float r, float g, float b, float maxAgeMul, boolean depthTest) {
return new WispParticleData(size, r, g, b, maxAgeMul, depthTest);
}
private WispParticleData(float size, float r, float g, float b, float maxAgeMul, boolean depthTest) {
this.size = size;
this.r = r;
this.g = g;
this.b = b;
this.maxAgeMul = maxAgeMul;
this.depthTest = depthTest;
}
@Nonnull
@Override
public ParticleType<WispParticleData> getType() {
return ModParticles.WISP;
}
@Override
public void write(PacketBuffer buf) {
buf.writeFloat(size);
buf.writeFloat(r);
buf.writeFloat(g);
buf.writeFloat(b);
buf.writeFloat(maxAgeMul);
buf.writeBoolean(depthTest);
}
@Nonnull
@Override
public String getParameters() {
return String.format(Locale.ROOT, "%s %.2f %.2f %.2f %.2f %.2f %s",
this.getType().getRegistryName(), this.size, this.r, this.g, this.b, this.maxAgeMul, this.depthTest);
}
public static final IDeserializer<WispParticleData> DESERIALIZER = new IDeserializer<WispParticleData>() {
@Nonnull
@Override
public WispParticleData deserialize(@Nonnull ParticleType<WispParticleData> type, @Nonnull StringReader reader) throws CommandSyntaxException {
reader.expect(' ');
float size = reader.readFloat();
reader.expect(' ');
float r = reader.readFloat();
reader.expect(' ');
float g = reader.readFloat();
reader.expect(' ');
float b = reader.readFloat();
reader.expect(' ');
float mam = reader.readFloat();
boolean depth = true;
if (reader.canRead()) {
reader.expect(' ');
depth = reader.readBoolean();
}
return new WispParticleData(size, r, g, b, mam, depth);
}
@Override
public WispParticleData read(@Nonnull ParticleType<WispParticleData> type, PacketBuffer buf) {
return new WispParticleData(buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readBoolean());
}
};
}
@@ -0,0 +1,14 @@
package vazkii.botania.client.fx;
import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.particles.ParticleType;
public class WispParticleType extends ParticleType<WispParticleData> {
public WispParticleType() {
super(false, WispParticleData.DESERIALIZER);
}
public static IParticleFactory<WispParticleData> FACTORY =
(data, world, x, y, z, xSpeed, ySpeed, zSpeed) ->
new FXWisp(world, x, y, z, xSpeed, ySpeed, zSpeed, data.size, data.r, data.g, data.b, data.depthTest, data.maxAgeMul);
}
@@ -165,9 +165,6 @@ public class GuiLexicon extends Screen {
// mc.updateWindowSize();
}
List<LexiconCategory> allCategories = new ArrayList<>(BotaniaAPI.getAllCategories());
Collections.sort(allCategories);
lastTime = ClientTickHandler.ticksInGame;
currentOpenLexicon = this;
@@ -184,6 +181,10 @@ public class GuiLexicon extends Screen {
}
populateIndex();
} else if(isCategoryIndex()) {
List<LexiconCategory> allCategories = new ArrayList<>(BotaniaAPI.getAllCategories());
allCategories.removeIf(cat -> !cat.isVisible(stackUsed));
Collections.sort(allCategories);
int categories = allCategories.size();
for(int i = 0; i < categories + 1; i++) {
LexiconCategory category;
@@ -50,8 +50,8 @@ public class ManaPoolRecipeCategory implements IRecipeCategory<RecipeManaInfusio
localizedName = I18n.format("botania.nei.manaPool");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pure_daisy_overlay.png"),
0, 0, 64, 46);
icon = guiHelper.createDrawableIngredient(renderStack.copy());
ItemNBTHelper.setBoolean(renderStack, "RenderFull", true);
icon = guiHelper.createDrawableIngredient(renderStack.copy());
}
@Nonnull
@@ -18,12 +18,12 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockState;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import vazkii.botania.api.recipe.RecipePureDaisy;
import vazkii.botania.common.block.ModSubtiles;
@@ -90,23 +90,21 @@ public class PureDaisyRecipeCategory implements IRecipeCategory<RecipePureDaisy>
BlockState state = recipe.getInput() instanceof BlockState ? (BlockState) recipe.getInput() : ((Block) recipe.getInput()).getDefaultState();
Block b = state.getBlock();
// todo 1.13 fluids
//if(FluidRegistry.lookupFluidForBlock(b) != null) {
// iIngredients.setInput(VanillaTypes.FLUID, new FluidStack(FluidRegistry.lookupFluidForBlock(b), 1000));
//} else {
if (b instanceof FlowingFluidBlock) {
iIngredients.setInput(VanillaTypes.FLUID, new FluidStack(((FlowingFluidBlock) b).getFluid(), 1000));
} else {
if(b.asItem() != Items.AIR)
iIngredients.setInput(VanillaTypes.ITEM, new ItemStack(b));
//}
}
}
Block outBlock = recipe.getOutputState().getBlock();
// todo 1.13 fluids
//if(FluidRegistry.lookupFluidForBlock(outBlock) != null) {
// iIngredients.setOutput(VanillaTypes.FLUID, new FluidStack(FluidRegistry.lookupFluidForBlock(outBlock), 1000));
//} else {
if(outBlock instanceof FlowingFluidBlock) {
iIngredients.setOutput(VanillaTypes.FLUID, new FluidStack(((FlowingFluidBlock) outBlock).getFluid(), 1000));
} else {
if(outBlock.asItem() != Items.AIR)
iIngredients.setOutput(VanillaTypes.ITEM, new ItemStack(outBlock));
//}
}
}
@Override
@@ -19,6 +19,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.ClientTickHandler;
@@ -103,7 +104,6 @@ public class RenderTileAltar extends TileEntityRenderer<TileAltar> {
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
int brightness = lava ? 240 : -1;
float alpha = lava ? 1F : 0.7F;
GlStateManager.enableBlend();
@@ -118,7 +118,9 @@ public class RenderTileAltar extends TileEntityRenderer<TileAltar> {
TextureAtlasSprite sprite = lava ? Minecraft.getInstance().getModelManager().getBlockModelShapes().getModel(Blocks.LAVA.getDefaultState()).getParticleTexture()
: Minecraft.getInstance().getModelManager().getBlockModelShapes().getModel(Blocks.WATER.getDefaultState()).getParticleTexture();
renderIcon(0, 0, sprite, 16, 16, brightness);
int color = lava ? Fluids.LAVA.getAttributes().getColor(altar.getWorld(), altar.getPos())
: Fluids.WATER.getAttributes().getColor(altar.getWorld(), altar.getPos());
renderIcon(sprite, color, alpha);
if(lava)
GlStateManager.enableLighting();
GlStateManager.enableAlphaTest();
@@ -128,15 +130,16 @@ public class RenderTileAltar extends TileEntityRenderer<TileAltar> {
GlStateManager.popMatrix();
}
private void renderIcon(int x, int y, TextureAtlasSprite sprite, int width, int height, int brightness) {
private void renderIcon(TextureAtlasSprite sprite, int color, float alpha) {
int red = ((color >> 16) & 0xFF);
int green = ((color >> 8) & 0xFF);
int blue = (color & 0xFF);
Tessellator tessellator = Tessellator.getInstance();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
//if(brightness != -1)
//tessellator.getBuffer().putBrightness4(brightness, brightness, brightness, brightness);
tessellator.getBuffer().pos(x + 0, y + height, 0).tex(sprite.getMinU(), sprite.getMaxV()).endVertex();
tessellator.getBuffer().pos(x + width, y + height, 0).tex(sprite.getMaxU(), sprite.getMaxV()).endVertex();
tessellator.getBuffer().pos(x + width, y + 0, 0).tex(sprite.getMaxU(), sprite.getMinV()).endVertex();
tessellator.getBuffer().pos(x + 0, y + 0, 0).tex(sprite.getMinU(), sprite.getMinV()).endVertex();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
tessellator.getBuffer().pos(0, 16, 0).tex(sprite.getMinU(), sprite.getMaxV()).color(red, green, blue, (int) (alpha * 255F)).endVertex();
tessellator.getBuffer().pos(16, 16, 0).tex(sprite.getMaxU(), sprite.getMaxV()).color(red, green, blue, (int) (alpha * 255F)).endVertex();
tessellator.getBuffer().pos(16, 0, 0).tex(sprite.getMaxU(), sprite.getMinV()).color(red, green, blue, (int) (alpha * 255F)).endVertex();
tessellator.getBuffer().pos(0, 0, 0).tex(sprite.getMinU(), sprite.getMinV()).color(red, green, blue, (int) (alpha * 255F)).endVertex();
tessellator.draw();
}
@@ -63,7 +63,7 @@ import vazkii.botania.common.core.loot.LootHandler;
import vazkii.botania.common.core.loot.TrueGuardianKiller;
import vazkii.botania.common.core.proxy.IProxy;
import vazkii.botania.common.core.proxy.ServerProxy;
import vazkii.botania.common.crafting.FluxfieldConditionFactory;
import vazkii.botania.common.crafting.FluxfieldCondition;
import vazkii.botania.common.crafting.ReloadListener;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.network.PacketHandler;
@@ -283,7 +283,7 @@ public class Botania {
CriteriaTriggers.register(RelicBindTrigger.INSTANCE);
CriteriaTriggers.register(UseItemSuccessTrigger.INSTANCE);
CraftingHelper.register(FluxfieldConditionFactory.KEY, new FluxfieldConditionFactory());
CraftingHelper.register(FluxfieldCondition.SERIALIZER);
ModBlocks.addDispenserBehaviours();
@@ -19,7 +19,6 @@ import net.minecraft.item.HoeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockReader;
@@ -31,7 +30,7 @@ import net.minecraftforge.common.PlantType;
import net.minecraftforge.common.ToolType;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.lexicon.LexiconData;
import javax.annotation.Nonnull;
@@ -106,14 +105,21 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
world.addParticle(ParticleTypes.FLAME, pos.getX() + r.nextFloat(), pos.getY() + 1.1, pos.getZ() + r.nextFloat(), 0, 0, 0);
break;
case INFUSED:
if(r.nextInt(100) == 0)
Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 0F, 1F, 1F, r.nextFloat() * 0.2F + 1F, 5);
if(r.nextInt(100) == 0) {
SparkleParticleData data = SparkleParticleData.sparkle(r.nextFloat() * 0.2F + 1F, 0F, 1F, 1F, 5);
world.addParticle(data, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 0, 0, 0);
}
break;
case MUTATED:
if(r.nextInt(100) == 0) {
if(r.nextInt(100) > 25)
Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 0F, 1F, r.nextFloat() * 0.2F + 1F, 5);
else Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 1F, 0F, r.nextFloat() * 0.2F + 1F, 5);
if(r.nextInt(100) > 25) {
SparkleParticleData data = SparkleParticleData.sparkle(r.nextFloat() * 0.2F + 1F, 1F, 0F, 1F, 5);
world.addParticle(data, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 0, 0, 0);
}
else {
SparkleParticleData data = SparkleParticleData.sparkle(r.nextFloat() * 0.2F + 1F, 1F, 1F, 0F, 5);
world.addParticle(data, pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 0, 0, 0);
}
}
break;
}
@@ -15,6 +15,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -31,7 +33,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IEnviromentBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
@@ -129,7 +131,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
if(stack.getItem() == ModItems.waterRod)
ManaItemHandler.requestManaExact(stack, player, ItemWaterRod.COST, true);
else if(!player.abilities.isCreativeMode)
player.setHeldItem(hand, new ItemStack(Items.BUCKET) /* todo 1.13 drain(FluidRegistry.WATER, stack) */);
player.setHeldItem(hand, drain(Fluids.WATER, stack));
tile.setWater(true);
world.updateComparatorOutputLevel(pos, this);
@@ -139,7 +141,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
return true;
} else if(!stack.isEmpty() && stack.getItem() == Items.LAVA_BUCKET) {
if(!player.abilities.isCreativeMode)
player.setHeldItem(hand, new ItemStack(Items.BUCKET) /* todo 1.13 drain(FluidRegistry.LAVA, stack) */);
player.setHeldItem(hand, drain(Fluids.LAVA, stack));
tile.setLava(true);
tile.setWater(false);
@@ -186,23 +188,16 @@ public class BlockAltar extends BlockMod implements ILexiconable {
if(stack.isEmpty() || stack.getCount() != 1)
return false;
LazyOptional<IFluidHandlerItem> cap = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY);
if(cap.isPresent()) {
IFluidHandler handler = cap.orElseThrow(IllegalStateException::new);
/* todo 1.13
FluidStack simulate = handler.drain(new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME), false);
if(simulate != null && simulate.getFluid() == FluidRegistry.WATER && simulate.amount == Fluid.BUCKET_VOLUME)
return true;
*/
}
return false;
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY).map(handler -> {
FluidStack simulate = handler.drain(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.SIMULATE);
return !simulate.isEmpty() && simulate.getFluid() == Fluids.WATER && simulate.getAmount() == FluidAttributes.BUCKET_VOLUME;
}).orElse(false);
}
private ItemStack drain(Fluid fluid, ItemStack stack) {
return stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)
.map(handler -> {
handler.drain(new FluidStack(fluid, Fluid.BUCKET_VOLUME), true);
handler.drain(new FluidStack(fluid, FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE);
return handler.getContainer();
})
.orElse(stack);
@@ -10,23 +10,18 @@
*/
package vazkii.botania.common.block;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import javax.annotation.Nonnull;
import java.util.Random;
@@ -39,8 +34,10 @@ public class BlockBifrostPerm extends BlockMod implements ILexiconable {
@OnlyIn(Dist.CLIENT)
@Override
public void animateTick(BlockState state, World world, BlockPos pos, Random rand) {
if(rand.nextBoolean())
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);
if(rand.nextBoolean()) {
SparkleParticleData data = SparkleParticleData.sparkle(0.45F + 0.2F * (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 6);
world.addParticle(data, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0, 0, 0);
}
}
@OnlyIn(Dist.CLIENT)
@@ -13,6 +13,7 @@ package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.AbstractRailBlock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.IProperty;
@@ -21,6 +22,10 @@ import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.RailShape;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.fml.common.Mod;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -28,15 +33,23 @@ import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class BlockGhostRail extends AbstractRailBlock implements ILexiconable {
private static final String TAG_FLOAT_TICKS = "Botania_FloatTicks";
private static final String TAG_FLOAT_TICKS = "botania:float_ticks";
public BlockGhostRail(Properties builder) {
super(true, builder);
setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.RAIL_SHAPE_STRAIGHT, RailShape.NORTH_SOUTH));
MinecraftForge.EVENT_BUS.addListener(this::cartSpawn);
MinecraftForge.EVENT_BUS.addListener(this::worldTick);
}
@Override
@@ -44,38 +57,60 @@ public class BlockGhostRail extends AbstractRailBlock implements ILexiconable {
builder.add(BlockStateProperties.RAIL_SHAPE_STRAIGHT);
}
/* todo 1.13
@SubscribeEvent
public static void onMinecartUpdate(MinecartUpdateEvent event) {
BlockPos entPos = new BlockPos(event.getEntity());
IBlockState state = event.getEntity().world.getBlockState(entPos);
Block block = state.getBlock();
boolean air = block.isAir(state, event.getEntity().world, entPos);
int floatTicks = event.getEntity().getEntityData().getInteger(TAG_FLOAT_TICKS);
if(block == ModBlocks.ghostRail)
event.getEntity().getEntityData().setInteger(TAG_FLOAT_TICKS, 20);
else if(block instanceof BlockRailBase || block == ModBlocks.dreamwood) {
event.getEntity().getEntityData().setInteger(TAG_FLOAT_TICKS, 0);
if(floatTicks > 0)
event.getEntity().world.playEvent(2003, entPos, 0);
}
floatTicks = event.getEntity().getEntityData().getInteger(TAG_FLOAT_TICKS);
private static void updateFloating(AbstractMinecartEntity cart, int floatTicks) {
BlockPos entPos = new BlockPos(cart);
BlockState state = cart.world.getBlockState(entPos);
boolean air = state.isAir(cart.world, entPos);
if(floatTicks > 0) {
IBlockState stateBelow = event.getEntity().world.getBlockState(entPos.down());
BlockState stateBelow = cart.world.getBlockState(entPos.down());
Block blockBelow = stateBelow.getBlock();
boolean airBelow = blockBelow.isAir(stateBelow, event.getEntity().world, entPos.down());
boolean airBelow = blockBelow.isAir(stateBelow, cart.world, entPos.down());
if(air && airBelow || !air && !airBelow)
event.getEntity().noClip = true;
event.getEntity().motionY = 0.2;
event.getEntity().motionX *= 1.4;
event.getEntity().motionZ *= 1.4;
event.getEntity().getEntityData().setInteger(TAG_FLOAT_TICKS, floatTicks - 1);
event.getEntity().world.playEvent(2000, entPos, 0);
} else event.getEntity().noClip = false;
cart.noClip = true;
cart.setMotion(cart.getMotion().getX() * 1.4, 0.2, cart.getMotion().getZ() * 1.4);
cart.getPersistentData().putInt(TAG_FLOAT_TICKS, floatTicks - 1);
cart.world.playEvent(2000, entPos, 0);
} else cart.noClip = false; // todo 1.14 doesn't seem to work for some reason?
}
@Override
public void onMinecartPass(BlockState state, World world, BlockPos pos, AbstractMinecartEntity cart) {
super.onMinecartPass(state, world, pos, cart);
if(!world.isRemote) {
int floatTicks = 20;
cart.getPersistentData().putInt(TAG_FLOAT_TICKS, floatTicks);
updateFloating(cart, floatTicks);
}
}
private final Map<DimensionType, Set<AbstractMinecartEntity>> carts = new HashMap<>();
private void cartSpawn(EntityJoinWorldEvent evt) {
if(!evt.getWorld().isRemote && evt.getEntity() instanceof AbstractMinecartEntity) {
carts.computeIfAbsent(evt.getWorld().getDimension().getType(), t -> Collections.newSetFromMap(new WeakHashMap<>()))
.add((AbstractMinecartEntity) evt.getEntity());
}
}
private void worldTick(TickEvent.WorldTickEvent evt) {
if(!evt.world.isRemote() && evt.phase == TickEvent.Phase.END) {
for (AbstractMinecartEntity c : carts.getOrDefault(evt.world.getDimension().getType(), Collections.emptySet())) {
BlockPos entPos = new BlockPos(c);
BlockState state = c.world.getBlockState(entPos);
Block block = state.getBlock();
int floatTicks = c.getPersistentData().getInt(TAG_FLOAT_TICKS);
if(block != ModBlocks.ghostRail
&& (block instanceof AbstractRailBlock || block == ModBlocks.dreamwood)) {
c.getPersistentData().putInt(TAG_FLOAT_TICKS, 0);
if(floatTicks > 0)
c.world.playEvent(2003, entPos, 0);
}
updateFloating(c, c.getPersistentData().getInt(TAG_FLOAT_TICKS));
}
}
}
*/
@Override
public LexiconEntry getEntry(World world, BlockPos pos, PlayerEntity player, ItemStack lexicon) {
@@ -14,27 +14,19 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.TallFlowerBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.state.properties.DoubleBlockHalf;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.IShearable;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.lexicon.LexiconData;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class BlockModDoubleFlower extends TallFlowerBlock implements ILexiconable {
@@ -58,8 +50,10 @@ public class BlockModDoubleFlower extends TallFlowerBlock implements ILexiconabl
int g = (hex & 0xFF00) >> 8;
int b = hex & 0xFF;
if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get())
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get()) {
SparkleParticleData data = SparkleParticleData.sparkle(rand.nextFloat(), r / 255F, g / 255F, b / 255F, 5);
world.addParticle(data, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, 0, 0, 0);
}
}
@@ -14,37 +14,23 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.DoublePlantBlock;
import net.minecraft.block.FlowerBlock;
import net.minecraft.block.DoublePlantBlock;
import net.minecraft.block.IGrowable;
import net.minecraft.block.SoundType;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Effect;
import net.minecraft.potion.Effects;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.Random;
@@ -90,8 +76,10 @@ public class BlockModFlower extends FlowerBlock implements ILexiconable, IGrowab
double y = pos.getY() + offset.y;
double z = pos.getZ() + offset.z;
if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get())
Botania.proxy.sparkleFX(x + 0.3 + rand.nextFloat() * 0.5, y + 0.5 + rand.nextFloat() * 0.5, z + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get()) {
SparkleParticleData data = SparkleParticleData.sparkle(rand.nextFloat(), r / 255F, g / 255F, b / 255F, 5);
world.addParticle(data, x + 0.3 + rand.nextFloat() * 0.5, y + 0.5 + rand.nextFloat() * 0.5, z + 0.3 + rand.nextFloat() * 0.5, 0, 0, 0);
}
}
@Override
@@ -67,7 +67,10 @@ public class BlockSpecialFlower extends FlowerBlock implements ISpecialFlower, I
@Override
public int getLightValue(@Nonnull BlockState state, IEnviromentBlockReader world, @Nonnull BlockPos pos) {
return world.getTileEntity(pos) == null ? 0 : ((TileEntitySpecialFlower) world.getTileEntity(pos)).getLightValue();
TileEntity te = world.getTileEntity(pos);
if (te instanceof TileEntitySpecialFlower) {
return ((TileEntitySpecialFlower) te).getLightValue();
} else return 0;
}
@Override
@@ -22,6 +22,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockModFlower;
import vazkii.botania.common.item.ModItems;
@@ -58,10 +59,8 @@ public class BlockBuriedPetals extends BlockModFlower {
int g = (hex & 0xFF00) >> 8;
int b = hex & 0xFF;
Botania.proxy.setSparkleFXNoClip(true);
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.1 + rand.nextFloat() * 0.1, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
Botania.proxy.setSparkleFXNoClip(false);
SparkleParticleData data = SparkleParticleData.noClip(rand.nextFloat(), r / 255F, g / 255F, b / 255F, 5);
world.addParticle(data, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.1 + rand.nextFloat() * 0.1, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, 0, 0, 0);
}
@Nonnull
@@ -32,7 +32,7 @@ import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.api.item.IFloatingFlower.IslandType;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.block.tile.TileFloatingFlower;
import vazkii.botania.common.core.handler.ConfigHandler;
@@ -79,8 +79,10 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable {
int g = (hex & 0xFF00) >> 8;
int b = hex & 0xFF;
if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get())
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get()) {
SparkleParticleData data = SparkleParticleData.sparkle(rand.nextFloat(), r / 255F, g / 255F, b / 255F, 5);
world.addParticle(data, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, 0, 0, 0);
}
}
@Override
@@ -30,7 +30,7 @@ import vazkii.botania.api.item.IHornHarvestable;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.recipe.ICustomApothecaryColor;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.lexicon.LexiconData;
@@ -77,8 +77,10 @@ public class BlockModMushroom extends MushroomBlock implements IHornHarvestable,
int g = (hex & 0xFF00) >> 8;
int b = hex & 0xFF;
if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get() * 0.25F)
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
if(rand.nextDouble() < ConfigHandler.CLIENT.flowerParticleFrequency.get() * 0.25F) {
SparkleParticleData data = SparkleParticleData.sparkle(rand.nextFloat(), r / 255F, g / 255F, b / 255F, 5);
world.addParticle(data, pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, 0, 0, 0);
}
}
@Override
@@ -13,14 +13,12 @@ package vazkii.botania.common.block.subtile;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.api.subtile.TileEntitySpecialFlower;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModSubtiles;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
@@ -44,8 +42,12 @@ public class SubTileManastar extends TileEntitySpecialFlower {
super.tickFlower();
if(getWorld().isRemote) {
if(state != NONE && Math.random() > 0.6)
Botania.proxy.wispFX(getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.75 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5, state == INCREASING ? 0.05F : 1F, 0.05F, state == INCREASING ? 1F : 0.05F, (float) Math.random() / 7, (float) -Math.random() / 50);
if(state != NONE && Math.random() > 0.6) {
float r = state == INCREASING ? 0.05F : 1F;
float b = state == INCREASING ? 1F : 0.05F;
WispParticleData data = WispParticleData.wisp((float) Math.random() / 7, r, 0.05F, b, 1);
world.addParticle(data, getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.75 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5, 0, (float) Math.random() / 50, 0);
}
} else {
int mana = 0;
for(Direction dir : MathHelper.HORIZONTALS) {
@@ -22,8 +22,8 @@ import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.recipe.RecipePureDaisy;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.TileEntitySpecialFlower;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModSubtiles;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
@@ -69,8 +69,9 @@ public class SubTilePureDaisy extends TileEntitySpecialFlower {
for (int i = 0; i < POSITIONS.length; i++) {
if ((activePositions >>> i & 1) > 0) {
BlockPos coords = getPos().add(POSITIONS[i]);
Botania.proxy.sparkleFX(coords.getX() + Math.random(), coords.getY() + Math.random(), coords.getZ() + Math.random(), 1F, 1F, 1F, (float) Math.random(), 5);
}
SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), 1F, 1F, 1F, 5);
world.addParticle(data, coords.getX() + Math.random(), coords.getY() + Math.random(), coords.getZ() + Math.random(), 0, 0, 0);
}
}
return;
@@ -145,7 +146,8 @@ public class SubTilePureDaisy extends TileEntitySpecialFlower {
double y = coords.getY() + Math.random() + 0.5;
double z = coords.getZ() + Math.random();
Botania.proxy.wispFX(x, y, z, 1F, 1F, 1F, (float) Math.random() / 2F);
WispParticleData data = WispParticleData.wisp((float) Math.random() / 2F, 1, 1, 1);
getWorld().addParticle(data, x, y, z, 0, 0, 0);
}
}
@@ -12,19 +12,13 @@ package vazkii.botania.common.block.subtile.functional;
import net.minecraft.block.BlockState;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -34,8 +28,7 @@ import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.TileEntityFunctionalFlower;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModSubtiles;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.network.PacketHandler;
@@ -61,8 +54,10 @@ public class SubTileDaffomill extends TileEntityFunctionalFlower {
public void tickFlower() {
super.tickFlower();
if(getWorld().rand.nextInt(4) == 0)
Botania.proxy.wispFX(getPos().getX() + Math.random(), getPos().getY() + Math.random(), getPos().getZ() + Math.random(), 0.05F, 0.05F, 0.05F, 0.25F + (float) Math.random() * 0.15F, orientation.getXOffset() * 0.1F, orientation.getYOffset() * 0.1F, orientation.getZOffset() * 0.1F);
if(getWorld().rand.nextInt(4) == 0) {
WispParticleData data = WispParticleData.wisp(0.25F + (float) Math.random() * 0.15F, 0.05F, 0.05F, 0.05F);
world.addParticle(data, getPos().getX() + Math.random(), getPos().getY() + Math.random(), getPos().getZ() + Math.random(), orientation.getXOffset() * 0.1F, orientation.getYOffset() * 0.1F, orientation.getZOffset() * 0.1F);
}
if(windTicks == 0 && mana > 0) {
windTicks = 20;
@@ -164,7 +164,7 @@ public class SubTileLoonuim extends TileEntityFunctionalFlower {
entity instanceof CreeperEntity ? 100 : Integer.MAX_VALUE, 0));
CompoundNBT cmp = stack.write(new CompoundNBT());
entity.getEntityData().put(TAG_ITEMSTACK_TO_DROP, cmp);
entity.getPersistentData().put(TAG_ITEMSTACK_TO_DROP, cmp);
entity.onInitialSpawn(world, world.getDifficultyForLocation(pos), SpawnReason.SPAWNER, null, null);
world.addEntity(entity);
@@ -216,8 +216,8 @@ public class SubTileLoonuim extends TileEntityFunctionalFlower {
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onDrops(LivingDropsEvent event) {
LivingEntity e = event.getEntityLiving();
if(e.getEntityData().contains(TAG_ITEMSTACK_TO_DROP)) {
CompoundNBT cmp = e.getEntityData().getCompound(TAG_ITEMSTACK_TO_DROP);
if(e.getPersistentData().contains(TAG_ITEMSTACK_TO_DROP)) {
CompoundNBT cmp = e.getPersistentData().getCompound(TAG_ITEMSTACK_TO_DROP);
ItemStack stack = ItemStack.read(cmp);
event.getDrops().clear();
event.getDrops().add(new ItemEntity(e.world, e.posX, e.posY, e.posZ, stack));
@@ -51,7 +51,7 @@ public class SubTileSpectranthemum extends TileEntityFunctionalFlower {
private static final int RANGE = 2;
private static final int BIND_RANGE = 12;
private static final String TAG_TELEPORTED = "Botania_TPd";
private static final String TAG_TELEPORTED = "botania:teleported";
private BlockPos bindPos = new BlockPos(0, -1, 0);
@@ -72,7 +72,7 @@ public class SubTileSpectranthemum extends TileEntityFunctionalFlower {
int slowdown = getSlowdownFactor();
for(ItemEntity item : items) {
if(item.age < 60 + slowdown || !item.isAlive() || item.getEntityData().getBoolean(TAG_TELEPORTED))
if(item.age < 60 + slowdown || !item.isAlive() || item.getPersistentData().getBoolean(TAG_TELEPORTED))
continue;
ItemStack stack = item.getItem();
@@ -85,7 +85,7 @@ public class SubTileSpectranthemum extends TileEntityFunctionalFlower {
if(mana >= cost) {
spawnExplosionParticles(item, 10);
item.setPosition(bindPos.getX() + 0.5, bindPos.getY() + 1.5, bindPos.getZ() + 0.5);
item.getEntityData().putBoolean(TAG_TELEPORTED, true);
item.getPersistentData().putBoolean(TAG_TELEPORTED, true);
item.setMotion(Vec3d.ZERO);
spawnExplosionParticles(item, 10);
mana -= cost;
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.block.subtile.functional;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.tileentity.TileEntityType;
@@ -19,8 +18,7 @@ import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.TileEntityFunctionalFlower;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModSubtiles;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.lexicon.LexiconData;
@@ -55,6 +53,7 @@ public class SubTileTangleberrie extends TileEntityFunctionalFlower {
AxisAlignedBB boundingBox = new AxisAlignedBB(x1 - range, y1 - range, z1 - range, x1 + range + 1, y1 + range + 1, z1 + range + 1);
List<LivingEntity> entities = getWorld().getEntitiesWithinAABB(LivingEntity.class, boundingBox);
SparkleParticleData data = SparkleParticleData.sparkle(1F, 0.5F, 0.5F, 0.5F, 3);
for(LivingEntity entity : entities) {
if(entity instanceof PlayerEntity || !entity.isNonBoss())
continue;
@@ -67,11 +66,9 @@ public class SubTileTangleberrie extends TileEntityFunctionalFlower {
if(distance > maxDist && distance < range) {
MathHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), getMotionVelocity());
if(getWorld().rand.nextInt(3) == 0)
Botania.proxy.sparkleFX(x2 + Math.random() * entity.getWidth(),
y2 + Math.random() * entity.getHeight(),
z2 + Math.random() * entity.getWidth(),
0.5F, 0.5F, 0.5F, 1F, 3);
if(getWorld().rand.nextInt(3) == 0) {
world.addParticle(data, x2 + Math.random() * entity.getWidth(), y2 + Math.random() * entity.getHeight(), z2 + Math.random() * entity.getWidth(), 0, 0, 0);
}
}
}
@@ -12,19 +12,16 @@ package vazkii.botania.common.block.subtile.generating;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.TNTEntity;
import net.minecraft.entity.item.TNTEntity;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.util.SoundEvents;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.TileEntityGeneratingFlower;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModSubtiles;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
@@ -67,8 +64,10 @@ public class SubTileEntropinnyum extends TileEntityGeneratingFlower {
if(getWorld().isRemote && getWorld().getEntityByID(param) instanceof TNTEntity) {
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);
for(int i = 0; i < 50; i++) {
SparkleParticleData data = SparkleParticleData.sparkle((float) (Math.random() * 0.65F + 1.25F), 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 12);
world.addParticle(data, e.posX + Math.random() * 4 - 2, e.posY + Math.random() * 4 - 2, e.posZ + Math.random() * 4 - 2, 0, 0, 0);
}
getWorld().addParticle(ParticleTypes.EXPLOSION_EMITTER, e.posX, e.posY, e.posZ, 1D, 0D, 0D);
}
@@ -14,14 +14,11 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.block.Blocks;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tags.FluidTags;
import net.minecraft.tags.Tag;
import net.minecraft.tileentity.TileEntityType;
@@ -34,8 +31,7 @@ import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.TileEntityGeneratingFlower;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModSubtiles;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
@@ -69,8 +65,10 @@ public class SubTileHydroangeas extends TileEntityGeneratingFlower {
if(cooldown > 0) {
cooldown--;
for(int i = 0; i < 3; i++)
Botania.proxy.wispFX(getPos().getX() + 0.5 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.5 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5 + Math.random() * 0.2 - 0.1, 0.1F, 0.1F, 0.1F, (float) Math.random() / 6, (float) -Math.random() / 30);
for(int i = 0; i < 3; i++) {
WispParticleData data = WispParticleData.wisp((float) Math.random() / 6, 0.1F, 0.1F, 0.1F, 1);
world.addParticle(data, getPos().getX() + 0.5 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.5 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5 + Math.random() * 0.2 - 0.1, 0, (float) Math.random() / 30, 0);
}
}
if(burnTime == 0) {
@@ -121,8 +119,9 @@ public class SubTileHydroangeas extends TileEntityGeneratingFlower {
}
public void doBurnParticles() {
Botania.proxy.wispFX(getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5, 0.05F, 0.05F, 0.7F, (float) Math.random() / 6, (float) -Math.random() / 60);
}
WispParticleData data = WispParticleData.wisp((float) Math.random() / 6, 0.05F, 0.05F, 0.7F, 1);
world.addParticle(data, getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5, 0, (float) Math.random() / 60, 0);
}
public Tag<Fluid> getMaterialToSearchFor() {
return FluidTags.WATER;
@@ -40,7 +40,7 @@ public class SubTileNarslimmus extends TileEntityGeneratingFlower {
@ObjectHolder(LibMisc.MOD_ID + ":narslimmus")
public static TileEntityType<SubTileNarslimmus> TYPE;
public static final String TAG_WORLD_SPAWNED = "Botania:WorldSpawned";
public static final String TAG_WORLD_SPAWNED = "botania:world_spawned";
private static final int RANGE = 2;
@@ -55,7 +55,7 @@ public class SubTileNarslimmus extends TileEntityGeneratingFlower {
if(ticksExisted % 5 == 0) {
List<SlimeEntity> slimes = getWorld().getEntitiesWithinAABB(SlimeEntity.class, new AxisAlignedBB(getPos().add(-RANGE, -RANGE, -RANGE), getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
for(SlimeEntity slime : slimes) {
if(slime.getEntityData().getBoolean(TAG_WORLD_SPAWNED) && slime.isAlive()) {
if(slime.getPersistentData().getBoolean(TAG_WORLD_SPAWNED) && slime.isAlive()) {
int size = slime.getSlimeSize();
int mul = (int) Math.pow(2, size);
int mana = 1200 * mul;
@@ -105,7 +105,7 @@ public class SubTileNarslimmus extends TileEntityGeneratingFlower {
if(event.getEntityLiving() instanceof SlimeEntity
&& event.getResult() != Event.Result.DENY
&& isSlimeChunk(event.getEntityLiving().world, event.getX(), event.getZ()))
event.getEntityLiving().getEntityData().putBoolean(TAG_WORLD_SPAWNED, true);
event.getEntityLiving().getPersistentData().putBoolean(TAG_WORLD_SPAWNED, true);
}
private static boolean isSlimeChunk(World world, double x, double z) {
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.block.subtile.generating;
import net.minecraft.block.material.Material;
import net.minecraft.fluid.Fluid;
import net.minecraft.tags.FluidTags;
import net.minecraft.tags.Tag;
@@ -18,8 +17,7 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModSubtiles;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
@@ -44,8 +42,9 @@ public class SubTileThermalily extends SubTileHydroangeas {
@Override
public void doBurnParticles() {
Botania.proxy.wispFX(getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.9 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5, 0.7F, 0.05F, 0.05F, (float) Math.random() / 6, (float) -Math.random() / 60);
}
WispParticleData data = WispParticleData.wisp((float) Math.random() / 6, 0.7F, 0.05F, 0.05F, 1);
world.addParticle(data, getPos().getX() + 0.55 + Math.random() * 0.2 - 0.1, getPos().getY() + 0.9 + Math.random() * 0.2 - 0.1, getPos().getZ() + 0.5, 0, (float) Math.random() / 60, 0);
}
@Override
public Tag<Fluid> getMaterialToSearchFor() {
@@ -12,17 +12,12 @@ package vazkii.botania.common.block.tile;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.block.Blocks;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.ITickableTileEntity;
@@ -40,7 +35,7 @@ import vazkii.botania.api.recipe.IElvenItem;
import vazkii.botania.api.recipe.RecipeElvenTrade;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.AlfPortalState;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.mana.BlockPool;
import vazkii.botania.common.block.tile.mana.TilePool;
@@ -149,7 +144,7 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
ItemStack stack = item.getItem();
boolean consume;
if (item.getEntityData().contains(TAG_PORTAL_FLAG)) {
if (item.getPersistentData().contains(TAG_PORTAL_FLAG)) {
consume = false;
} else if (stack.getItem() instanceof ItemLexicon) {
consume = true;
@@ -216,8 +211,9 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
pos = CONVERTER_X_Z_FP.apply(pos);
float motionMul = 0.2F;
Botania.proxy.wispFX(getPos().getX() + pos[0], getPos().getY() + pos[1], getPos().getZ() + pos[2], (float) (Math.random() * 0.25F), (float) (Math.random() * 0.5F + 0.5F), (float) (Math.random() * 0.25F), (float) (Math.random() * 0.15F + 0.1F), (float) (Math.random() - 0.5F) * motionMul, (float) (Math.random() - 0.5F) * motionMul, (float) (Math.random() - 0.5F) * motionMul);
}
WispParticleData data = WispParticleData.wisp((float) (Math.random() * 0.15F + 0.1F), (float) (Math.random() * 0.25F), (float) (Math.random() * 0.5F + 0.5F), (float) (Math.random() * 0.25F));
world.addParticle(data, getPos().getX() + pos[0], getPos().getY() + pos[1], getPos().getZ() + pos[2], (float) (Math.random() - 0.5F) * motionMul, (float) (Math.random() - 0.5F) * motionMul, (float) (Math.random() - 0.5F) * motionMul);
}
public boolean onWanded() {
AlfPortalState state = world.getBlockState(getPos()).get(BotaniaStateProps.ALFPORTAL_STATE);
@@ -277,7 +273,7 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
private void spawnItem(ItemStack stack) {
ItemEntity item = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, stack);
item.getEntityData().putBoolean(TAG_PORTAL_FLAG, true);
item.getPersistentData().putBoolean(TAG_PORTAL_FLAG, true);
world.addEntity(item);
ticksSinceLastItem = 0;
}
@@ -14,31 +14,26 @@ import net.minecraft.client.Minecraft;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.block.Blocks;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Items;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -51,7 +46,7 @@ import vazkii.botania.api.recipe.ICustomApothecaryColor;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.lib.LibBlockNames;
@@ -115,26 +110,24 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
if(!hasWater() && !hasLava()) {
if(hasFluidCapability) {
/* todo 1.13
IFluidHandlerItem fluidHandler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null);
IFluidHandlerItem fluidHandler = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY).orElseThrow(NullPointerException::new);
FluidStack drainWater = fluidHandler.drain(new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME), false);
FluidStack drainLava = fluidHandler.drain(new FluidStack(FluidRegistry.LAVA, Fluid.BUCKET_VOLUME), false);
FluidStack drainWater = fluidHandler.drain(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.SIMULATE);
FluidStack drainLava = fluidHandler.drain(new FluidStack(Fluids.LAVA, FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.SIMULATE);
if(drainWater != null && drainWater.getFluid() == FluidRegistry.WATER && drainWater.amount == Fluid.BUCKET_VOLUME) {
if(!drainWater.isEmpty() && drainWater.getFluid() == Fluids.WATER && drainWater.getAmount() == FluidAttributes.BUCKET_VOLUME) {
setWater(true);
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
fluidHandler.drain(new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME), true);
fluidHandler.drain(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE);
item.setItem(fluidHandler.getContainer());
return true;
} else if(drainLava != null && drainLava.getFluid() == FluidRegistry.LAVA && drainLava.amount == Fluid.BUCKET_VOLUME) {
} else if(!drainLava.isEmpty() && drainLava.getFluid() == Fluids.LAVA && drainLava.getAmount() == FluidAttributes.BUCKET_VOLUME) {
setLava(true);
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
fluidHandler.drain(new FluidStack(FluidRegistry.LAVA, Fluid.BUCKET_VOLUME), true);
fluidHandler.drain(new FluidStack(Fluids.LAVA, FluidAttributes.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE);
item.setItem(fluidHandler.getContainer());
return true;
}
*/
}
return false;
@@ -273,8 +266,9 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
float blue = color.getBlue() / 255F;
if(Math.random() >= 0.75F)
world.playSound(null, pos, SoundEvents.ENTITY_GENERIC_SPLASH, SoundCategory.BLOCKS, 0.1F, 10F);
Botania.proxy.sparkleFX(pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1.2, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
}
SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), red, green, blue, 10);
world.addParticle(data, pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1.2, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, 0, 0, 0);
}
}
if(hasLava()) {
@@ -315,8 +309,9 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary,
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);
}
SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), red, green, blue, 10);
world.addParticle(data, pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, 0, 0, 0);
}
world.playSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.altarCraft, SoundCategory.BLOCKS, 1F, 1F, false);
}
return true;
@@ -29,7 +29,8 @@ import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.lib.LibBlockNames;
@@ -128,9 +129,12 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
float g = color.getGreen() / 255F;
float b = color.getBlue() / 255F;
for(int i = 0; i < 5; i++) {
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, r, g, b, 0.1F + (float) Math.random() * 0.05F, 0.03F - (float) Math.random() * 0.06F, 0.03F + (float) Math.random() * 0.015F, 0.03F - (float) Math.random() * 0.06F);
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.03F - (float) Math.random() * 0.06F, 0.03F + (float) Math.random() * 0.015F, 0.03F - (float) Math.random() * 0.06F);
WispParticleData data1 = WispParticleData.wisp(0.1F + (float) Math.random() * 0.05F, r, g, b);
world.addParticle(data1, 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.03F - (float) Math.random() * 0.06F, 0.03F + (float) Math.random() * 0.015F, 0.03F - (float) Math.random() * 0.06F);
for(int j = 0; j < 2; j++) {
WispParticleData data = WispParticleData.wisp(0.1F + (float) Math.random() * 0.2F, 0.2F, 0.2F, 0.2F);
world.addParticle(data, 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.03F - (float) Math.random() * 0.06F, 0.03F + (float) Math.random() * 0.015F, 0.03F - (float) Math.random() * 0.06F);
}
}
}
@@ -170,9 +174,12 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
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);
SparkleParticleData data1 = SparkleParticleData.sparkle((float) Math.random() * 2F + 0.5F, r, g, b, 10);
world.addParticle(data1, pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, 0, 0, 0);
for(int j = 0; j < 2; j++) {
WispParticleData data = WispParticleData.wisp(0.1F + (float) Math.random() * 0.2F, 0.2F, 0.2F, 0.2F);
world.addParticle(data, 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.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);
}
@@ -48,7 +48,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.client.fx.SparkleParticleData;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.lib.LibBlockNames;
@@ -307,10 +307,9 @@ public class TileEnchanter extends TileMod implements ISparkAttachable, ITickabl
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);
}
SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), red, green, blue, 10);
world.addParticle(data, getPos().getX() + Math.random() * 0.4 - 0.2, getPos().getY(), getPos().getZ() + Math.random() * 0.4 - 0.2, 0, 0, 0);
}
world.playSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.enchanterEnchant, SoundCategory.BLOCKS, 1F, 1F, false);
}
return true;
@@ -10,24 +10,21 @@
*/
package vazkii.botania.common.block.tile;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.potion.Effects;
import net.minecraft.util.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.Effects;
import net.minecraft.potion.EffectInstance;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.brew.ItemIncenseStick;
import vazkii.botania.common.lib.LibBlockNames;
@@ -81,9 +78,11 @@ public class TileIncensePlate extends TileSimpleInventory implements ITickableTi
float r = color.getRed() / 255F;
float g = color.getGreen() / 255F;
float b = color.getBlue() / 255F;
Botania.proxy.wispFX(x - (Math.random() - 0.5) * 0.2, y - (Math.random() - 0.5) * 0.2, z - (Math.random() - 0.5) * 0.2, r, g, b, 0.05F + (float) Math.random() * 0.02F, 0.005F - (float) Math.random() * 0.01F, 0.01F + (float) Math.random() * 0.005F, 0.005F - (float) Math.random() * 0.01F);
Botania.proxy.wispFX(x - (Math.random() - 0.5) * 0.2, y - (Math.random() - 0.5) * 0.2, z - (Math.random() - 0.5) * 0.2, 0.2F, 0.2F, 0.2F, 0.05F + (float) Math.random() * 0.02F, 0.005F - (float) Math.random() * 0.01F, 0.01F + (float) Math.random() * 0.001F, 0.005F - (float) Math.random() * 0.01F);
}
WispParticleData data1 = WispParticleData.wisp(0.05F + (float) Math.random() * 0.02F, r, g, b);
world.addParticle(data1, x - (Math.random() - 0.5) * 0.2, y - (Math.random() - 0.5) * 0.2, z - (Math.random() - 0.5) * 0.2, 0.005F - (float) Math.random() * 0.01F, 0.01F + (float) Math.random() * 0.005F, 0.005F - (float) Math.random() * 0.01F);
WispParticleData data = WispParticleData.wisp(0.05F + (float) Math.random() * 0.02F, 0.2F, 0.2F, 0.2F);
world.addParticle(data, x - (Math.random() - 0.5) * 0.2, y - (Math.random() - 0.5) * 0.2, z - (Math.random() - 0.5) * 0.2, 0.005F - (float) Math.random() * 0.01F, 0.01F + (float) Math.random() * 0.001F, 0.005F - (float) Math.random() * 0.01F);
}
} else {
itemHandler.setStackInSlot(0, ItemStack.EMPTY);
burning = false;
@@ -18,17 +18,14 @@ import javax.annotation.Nonnull;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.item.EnderPearlEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
@@ -37,26 +34,23 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.LuminizerVariant;
import vazkii.botania.api.wand.IWandBindable;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.block.BlockLightRelay;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibEntityNames;
import vazkii.botania.common.lib.LibMisc;
public class TileLightRelay extends TileMod implements ITickableTileEntity, IWandBindable {
@@ -116,7 +110,8 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
mul = Math.min(maxMul, mul + mulPer);
double rad = radPer * (i + ticksElapsed * 0.4);
Vector3 vecRot = vecMag.crossProduct(Vector3.ONE).multiply(mul).rotate(rad, vecMag).add(vecTip);
Botania.proxy.wispFX(vecRot.x, vecRot.y, vecRot.z, 0.4F, 0.4F, 1F, 0.1F, (float) -vecMag.x, (float) -vecMag.y, (float) -vecMag.z, 1F);
WispParticleData data = WispParticleData.wisp(0.1F, 0.4F, 0.4F, 1F, 1);
world.addParticle(data, vecRot.x, vecRot.y, vecRot.z, (float) -vecMag.x, (float) -vecMag.y, (float) -vecMag.z);
vecTip = vecTip.add(vecMag);
}
}
@@ -327,8 +322,9 @@ public class TileLightRelay extends TileMod implements ITickableTileEntity, IWan
double sin = Math.sin(rad);
double s = 0.4;
Botania.proxy.sparkleFX(posX + cos * s, posY - 0.5, posZ + sin * s, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1.2F, 10);
}
SparkleParticleData data = SparkleParticleData.sparkle(1.2F, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 10);
world.addParticle(data, posX + cos * s, posY - 0.5, posZ + sin * s, 0, 0, 0);
}
posX += motVec.x;
posY += motVec.y;
@@ -14,7 +14,7 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
@@ -66,8 +66,9 @@ public class TileManaFlame extends TileMod implements ITickableTileEntity {
float s = 0.2F + (float) Math.random() * 0.1F;
float m = 0.03F + (float) Math.random() * 0.015F;
Botania.proxy.wispFX(x, y, z, r, g, b, s, -m);
}
WispParticleData data = WispParticleData.wisp(s, r, g, b, 1);
world.addParticle(data, x, y, z, 0, m, 0);
}
}
public int getLightColor() {
@@ -18,7 +18,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.AlfPortalState;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.block.BlockModFlower;
import vazkii.botania.common.block.BlockPylon;
import vazkii.botania.common.block.ModBlocks;
@@ -73,9 +74,12 @@ public class TilePylon extends TileEntity implements ITickableTileEntity {
centerBlock = centerBlock.subtract(new Vector3(0, 0.5, 0));
Vector3 movementVector = centerBlock.subtract(ourCoords).normalize().multiply(0.2);
Botania.proxy.wispFX(x, pos.getY() + 0.25, z, (float) Math.random() * 0.25F, 0.75F + (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 0.25F + (float) Math.random() * 0.1F, -0.075F - (float) Math.random() * 0.015F);
if(world.rand.nextInt(3) == 0)
Botania.proxy.wispFX(x, pos.getY() + 0.25, z, (float) Math.random() * 0.25F, 0.75F + (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 0.25F + (float) Math.random() * 0.1F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
WispParticleData data = WispParticleData.wisp(0.25F + (float) Math.random() * 0.1F, (float) Math.random() * 0.25F, 0.75F + (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 1);
world.addParticle(data, x, pos.getY() + 0.25, z, 0, -(-0.075F - (float) Math.random() * 0.015F), 0);
if(world.rand.nextInt(3) == 0) {
WispParticleData data1 = WispParticleData.wisp(0.25F + (float) Math.random() * 0.1F, (float) Math.random() * 0.25F, 0.75F + (float) Math.random() * 0.25F, (float) Math.random() * 0.25F);
world.addParticle(data1, x, pos.getY() + 0.25, z, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
}
}
} else {
Vector3 ourCoords = Vector3.fromTileEntityCenter(this).add(0, 1 + (Math.random() - 0.5 * 0.25), 0);
@@ -88,18 +92,28 @@ public class TilePylon extends TileEntity implements ITickableTileEntity {
int g = (hex & 0xFF00) >> 8;
int b = hex & 0xFF;
if(world.rand.nextInt(4) == 0)
Botania.proxy.sparkleFX(centerBlock.x + (Math.random() - 0.5) * 0.5, centerBlock.y, centerBlock.z + (Math.random() - 0.5) * 0.5, r / 255F, g / 255F, b / 255F, (float) Math.random(), 8);
if(world.rand.nextInt(4) == 0) {
SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), r / 255F, g / 255F, b / 255F, 8);
world.addParticle(data, centerBlock.x + (Math.random() - 0.5) * 0.5, centerBlock.y, centerBlock.z + (Math.random() - 0.5) * 0.5, 0, 0, 0);
}
Botania.proxy.wispFX(pos.getX() + 0.5 + (Math.random() - 0.5) * 0.25, pos.getY() - 0.5, pos.getZ() + 0.5 + (Math.random() - 0.5) * 0.25, r / 255F, g / 255F, b / 255F, (float) Math.random() / 3F, -0.04F);
Botania.proxy.wispFX(pos.getX() + 0.5 + (Math.random() - 0.5) * 0.125, pos.getY() + 1.5, pos.getZ() + 0.5 + (Math.random() - 0.5) * 0.125, r / 255F, g / 255F, b / 255F, (float) Math.random() / 5F, -0.001F);
Botania.proxy.wispFX(pos.getX() + 0.5 + (Math.random() - 0.5) * 0.25, pos.getY() + 1.5, pos.getZ() + 0.5 + (Math.random() - 0.5) * 0.25, r / 255F, g / 255F, b / 255F, (float) Math.random() / 8F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
WispParticleData data1 = WispParticleData.wisp((float) Math.random() / 3F, r / 255F, g / 255F, b / 255F, 1);
world.addParticle(data1, pos.getX() + 0.5 + (Math.random() - 0.5) * 0.25, pos.getY() - 0.5, pos.getZ() + 0.5 + (Math.random() - 0.5) * 0.25, 0, - -0.04F, 0);
WispParticleData data = WispParticleData.wisp((float) Math.random() / 5F, r / 255F, g / 255F, b / 255F, 1);
world.addParticle(data, pos.getX() + 0.5 + (Math.random() - 0.5) * 0.125, pos.getY() + 1.5, pos.getZ() + 0.5 + (Math.random() - 0.5) * 0.125, 0, - -0.001F, 0);
WispParticleData data2 = WispParticleData.wisp((float) Math.random() / 8F, r / 255F, g / 255F, b / 255F);
world.addParticle(data2, pos.getX() + 0.5 + (Math.random() - 0.5) * 0.25, pos.getY() + 1.5, pos.getZ() + 0.5 + (Math.random() - 0.5) * 0.25, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
}
}
}
if(world.rand.nextBoolean() && world.isRemote)
Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random() * 1.5, pos.getZ() + Math.random(), variant == BlockPylon.Variant.GAIA ? 1F : 0.5F, variant == BlockPylon.Variant.NATURA ? 1F : 0.5F, variant == BlockPylon.Variant.NATURA ? 0.5F : 1F, (float) Math.random(), 2);
if(world.rand.nextBoolean() && world.isRemote) {
float r = variant == BlockPylon.Variant.GAIA ? 1F : 0.5F;
float g = variant == BlockPylon.Variant.NATURA ? 1F : 0.5F;
float b = variant == BlockPylon.Variant.NATURA ? 0.5F : 1F;
SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), r, g, b, 2);
world.addParticle(data, pos.getX() + Math.random(), pos.getY() + Math.random() * 1.5, pos.getZ() + Math.random(), 0, 0, 0);
}
}
private Block getBlockForMeta() {
@@ -14,16 +14,12 @@ import net.minecraft.client.Minecraft;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Hand;
import net.minecraft.util.Hand;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
@@ -36,6 +32,8 @@ import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ModSounds;
@@ -44,8 +42,6 @@ import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.material.ItemRune;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.network.PacketBotaniaEffect;
import vazkii.botania.common.network.PacketHandler;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -127,8 +123,9 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
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);
}
SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), red, green, blue, 10);
world.addParticle(data, pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, 0, 0, 0);
}
world.playSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.runeAltarCraft, SoundCategory.BLOCKS, 1, 1, false);
}
return true;
@@ -173,8 +170,10 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
Botania.proxy.lightningFX(vec, endVec, 2F, 0x00948B, 0x00E4D7);
}
if (cooldown > 0)
Botania.proxy.wispFX(pos.getX() + Math.random(), pos.getY() + 0.8, pos.getZ() + Math.random(), 0.2F, 0.2F, 0.2F, 0.2F, -0.025F);
if (cooldown > 0) {
WispParticleData data = WispParticleData.wisp(0.2F, 0.2F, 0.2F, 0.2F, 1);
world.addParticle(data, pos.getX() + Math.random(), pos.getY() + 0.8, pos.getZ() + Math.random(), 0, - -0.025F, 0);
}
}
if(cooldown > 0) {
@@ -14,27 +14,20 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.ILivingEntityData;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.MobSpawnerTileEntity;
import net.minecraft.world.spawner.AbstractSpawner;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.MobSpawnerTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.WeightedSpawnerEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.spawner.AbstractSpawner;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
@@ -66,8 +59,10 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver, ITickable
BlockPos blockpos = logic.getSpawnerPosition();
if (world.isRemote) {
// Botania - use own particles
if(Math.random() > 0.5)
Botania.proxy.wispFX(getPos().getX() + 0.3 + Math.random() * 0.5, getPos().getY() - 0.3 + Math.random() * 0.25, getPos().getZ() + Math.random(), 0.6F - (float) Math.random() * 0.3F, 0.1F, 0.6F - (float) Math.random() * 0.3F, (float) Math.random() / 3F, -0.025F - 0.005F * (float) Math.random(), 2F);
if(Math.random() > 0.5) {
WispParticleData data = WispParticleData.wisp((float) Math.random() / 3F, 0.6F - (float) Math.random() * 0.3F, 0.1F, 0.6F - (float) Math.random() * 0.3F, 2F);
world.addParticle(data, getPos().getX() + 0.3 + Math.random() * 0.5, getPos().getY() - 0.3 + Math.random() * 0.25, getPos().getZ() + Math.random(), 0, -(-0.025F - 0.005F * (float) Math.random()), 0);
}
if (logic.spawnDelay > 0) {
--logic.spawnDelay;
}
@@ -11,7 +11,7 @@
package vazkii.botania.common.block.tile;
import net.minecraft.tileentity.ITickableTileEntity;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
public class TileSpiritShrine extends TileMod implements ITickableTileEntity {
@@ -54,8 +54,11 @@ public class TileSpiritShrine extends TileMod implements ITickableTileEntity {
wticks += tickIncrement;
float[] colorsfx = colors[i >= colors.length ? 0 : i];
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float)g * 0.05F, 0.25F);
Botania.proxy.wispFX(x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F);
WispParticleData data = WispParticleData.wisp(0.85F, colorsfx[0], colorsfx[1], colorsfx[2], 0.25F);
world.addParticle(data, x, y, z, 0, (float) (-g * 0.05), 0);
data = WispParticleData.wisp((float) Math.random() * 0.1F + 0.1F, colorsfx[0], colorsfx[1], colorsfx[2], 0.9F);
world.addParticle(data, x, y, z, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F);
}
}
}
@@ -13,7 +13,7 @@ package vazkii.botania.common.block.tile;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
@@ -46,8 +46,9 @@ public class TileStarfield extends TileMod implements ITickableTileEntity {
float s = 20F + (float) Math.random() * 20F;
int m = 50;
Botania.proxy.sparkleFX(x, y, z, r, g, b, s, m);
}
SparkleParticleData data = SparkleParticleData.sparkle(s, r, g, b, m);
world.addParticle(data, x, y, z, 0, 0, 0);
}
}
}
@@ -82,6 +82,8 @@ public class TileCorporeaRetainer extends TileMod {
ICorporeaRequestor requestor = (ICorporeaRequestor) inv.world.getTileEntity(inv.pos);
requestor.doCorporeaRequest(request, requestCount, spark);
pendingRequest = false;
compValue = 0;
world.updateComparatorOutputLevel(getPos(), world.getBlockState(getPos()).getBlock());
}
}
@@ -18,7 +18,7 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.block.tile.TileMod;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
@@ -39,8 +39,10 @@ public class TileManaDetector extends TileMod implements ITickableTileEntity {
world.setBlockState(getPos(), world.getBlockState(getPos()).with(BotaniaStateProps.POWERED, expectedState));
if(expectedState)
for(int i = 0; i < 4; i++)
Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 1F, 0.2F, 0.2F, 0.7F + 0.5F * (float) Math.random(), 5);
for(int i = 0; i < 4; i++) {
SparkleParticleData data = SparkleParticleData.sparkle(0.7F + 0.5F * (float) Math.random(), 1F, 0.2F, 0.2F, 5);
world.addParticle(data, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0, 0, 0);
}
}
}
@@ -13,7 +13,7 @@ package vazkii.botania.common.block.tile.mana;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.mana.IClientManaHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.block.tile.TileMod;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
@@ -39,8 +39,10 @@ public class TileManaVoid extends TileMod implements IClientManaHandler {
@Override
public void recieveMana(int mana) {
if(mana > 0)
for(int i = 0; i < 10; i++)
Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0.2F, 0.2F, 0.2F, 0.7F + 0.5F * (float) Math.random(), 5);
for(int i = 0; i < 10; i++) {
SparkleParticleData data = SparkleParticleData.sparkle(0.7F + 0.5F * (float) Math.random(), 0.2F, 0.2F, 0.2F, 5);
world.addParticle(data, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0, 0, 0);
}
}
@Override
@@ -13,21 +13,15 @@ package vazkii.botania.common.block.tile.mana;
import com.google.common.base.Predicates;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
@@ -35,8 +29,6 @@ import net.minecraft.util.Direction;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.registries.ObjectHolder;
@@ -52,10 +44,10 @@ 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.state.BotaniaStateProps;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.mana.BlockPool;
@@ -226,9 +218,9 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
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);
}
SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), red, green, blue, 10);
world.addParticle(data, pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 0.75, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, 0, 0, 0);
}
}
return true;
@@ -259,8 +251,10 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
if(world.isRemote) {
double particleChance = 1F - (double) getCurrentMana() / (double) manaCap * 0.1;
if(Math.random() > particleChance)
Botania.proxy.wispFX(pos.getX() + 0.3 + Math.random() * 0.5, pos.getY() + 0.6 + Math.random() * 0.25, pos.getZ() + Math.random(), PARTICLE_COLOR.getRed() / 255F, PARTICLE_COLOR.getGreen() / 255F, PARTICLE_COLOR.getBlue() / 255F, (float) Math.random() / 3F, (float) -Math.random() / 25F, 2F);
if(Math.random() > particleChance) {
WispParticleData data = WispParticleData.wisp((float) Math.random() / 3F, PARTICLE_COLOR.getRed() / 255F, PARTICLE_COLOR.getGreen() / 255F, PARTICLE_COLOR.getBlue() / 255F, 2F);
world.addParticle(data, pos.getX() + 0.3 + Math.random() * 0.5, pos.getY() + 0.6 + Math.random() * 0.25, pos.getZ() + Math.random(), 0, (float) Math.random() / 25F, 0);
}
return;
}
@@ -398,7 +392,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
@OnlyIn(Dist.CLIENT)
public void renderHUD(Minecraft mc) {
ItemStack pool = new ItemStack(getBlockState().getBlock());
String name = I18n.format(pool.getTranslationKey().replaceAll("tile.", "tile." + LibResources.PREFIX_MOD) + ".name");
String name = pool.getDisplayName().getString();
int color = 0x4444FF;
HUDHandler.drawSimpleManaHUD(color, knownMana, manaCap, name);
@@ -38,6 +38,7 @@ import vazkii.botania.api.subtile.TileEntityGeneratingFlower;
import vazkii.botania.api.subtile.TileEntitySpecialFlower;
import vazkii.botania.client.core.handler.BossBarHandler;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockModFlower;
import vazkii.botania.common.block.ModBlocks;
@@ -149,8 +150,9 @@ public class InternalMethodHandler extends DummyMethodHandler {
@Override
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {
Botania.proxy.sparkleFX(x, y, z, r, g, b, size, m);
}
SparkleParticleData data = SparkleParticleData.sparkle(size, r, g, b, m);
world.addParticle(data, x, y, z, 0, 0, 0);
}
@Override
public ResourceLocation getDefaultBossBarTexture() {
@@ -140,35 +140,39 @@ public final class ItemNBTHelper {
}
/**
* Checks that one tag is a subset of another - that is, it's ok if the superset has more NBT keys than the subset, but the subset has to have at least all the same keys as the superset, and the values of the keys that *are* shared between the two must match.
*
* This is useful when, e.g. matching NBT tags in recipes.
* Returns true if the `target` tag contains all of the tags and values present in the `template` tag. Recurses into
* compound tags and matches all template keys and values; recurses into list tags and matches the template against
* the first elements of target. Empty lists and compounds in the template will match target lists and compounds of
* any size.
*/
public static boolean isTagSubset(@Nullable CompoundNBT subset, @Nullable CompoundNBT superset) {
//an empty set is a subset of everything
if(subset == null || subset.isEmpty()) return true;
//an empty set is a superset of only another empty set (which was already checked above)
if(superset == null || superset.isEmpty()) return false;
//a subset can't be bigger than its superset
if(subset.keySet().size() > superset.keySet().size()) return false;
public static boolean matchTag(@Nullable INBT template, @Nullable INBT target) {
if(template instanceof CompoundNBT && target instanceof CompoundNBT) {
return matchTagCompound((CompoundNBT) template, (CompoundNBT) target);
} else if(template instanceof ListNBT && target instanceof ListNBT) {
return matchTagList((ListNBT) template, (ListNBT) target);
} else {
return template == null || (target != null && target.equals(template));
}
}
private static boolean matchTagCompound(CompoundNBT template, CompoundNBT target) {
if(template.size() > target.size()) return false;
//it's not an easy case, so we actually have to check the contents of each tag
for(String key : superset.keySet()) {
//it's ok if the subset is missing a key from the superset
if(!subset.contains(key)) continue;
INBT supersetEntry = superset.get(key);
INBT subsetEntry = subset.get(key);
//if a value is present on both tags, but they do not match, fail
if(supersetEntry instanceof CompoundNBT && subsetEntry instanceof CompoundNBT) {
//recurse into tag compounds (this properly compares nested tag compounds)
if(!isTagSubset((CompoundNBT) subsetEntry, (CompoundNBT) supersetEntry)) return false;
} else {
if(!supersetEntry.equals(subsetEntry)) return false;
}
for(String key : template.keySet()) {
if (!matchTag(template.get(key), target.get(key))) return false;
}
return true;
}
private static boolean matchTagList(ListNBT template, ListNBT target) {
if (template.size() > target.size()) return false;
for (int i = 0; i < template.size(); i++) {
if (!matchTag(template.get(i), target.get(i))) return false;
}
return true;
}
}
@@ -21,7 +21,7 @@ public final class StringObfuscator {
return getHash(str).equals(hash);
}
public static String getHash(String str) {
private static String getHash(String str) {
if(str != null)
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
@@ -32,9 +32,10 @@ public final class StringObfuscator {
return "";
}
private static String dontRainbowTableMeOrMySonEverAgain(String str) {
private static String dontRainbowTableMeOrMySonEverAgain(String str) throws NoSuchAlgorithmException {
str += reverseString(str);
SecureRandom rand = new SecureRandom(str.getBytes());
SecureRandom rand = SecureRandom.getInstance("SHA1PRNG");
rand.setSeed(str.getBytes());
int l = str.length();
int steps = rand.nextInt(l);
char[] chrs = str.toCharArray();
@@ -52,10 +53,7 @@ public final class StringObfuscator {
}
private static String reverseString(String str) {
char[] chars = new char[str.length()];
for(int i = 0; i < chars.length; i++)
chars[i] = str.charAt(str.length() - 1 - i);
return String.copyValueOf(chars);
return new StringBuilder(str).reverse().toString();
}
}
@@ -4,11 +4,12 @@ import net.minecraft.block.Block;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.particles.IParticleData;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.core.helper.Vector3;
public interface IProxy {
@@ -36,38 +37,6 @@ public interface IProxy {
long getWorldElapsedTicks();
void setSparkleFXNoClip(boolean noclip);
void setSparkleFXCorrupt(boolean corrupt);
default void sparkleFX(double x, double y, double z, float r, float g, float b, float size, int m) {
sparkleFX(x, y, z, r, g, b, size, m, false);
}
void sparkleFX(double x, double y, double z, float r, float g, float b, float size, int m, boolean fake);
void setWispFXDistanceLimit(boolean limit);
void setWispFXDepthTest(boolean depth);
default void wispFX(double x, double y, double z, float r, float g, float b, float size) {
wispFX(x, y, z, r, g, b, size, 0F);
}
default void wispFX(double x, double y, double z, float r, float g, float b, float size, float gravity) {
wispFX(x, y, z, r, g, b, size, gravity, 1F);
}
default void wispFX(double x, double y, double z, float r, float g, float b, float size, float gravity, float maxAgeMul) {
wispFX(x, y, z, r, g, b, size, 0, -gravity, 0, maxAgeMul);
}
default void wispFX(double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz) {
wispFX(x, y, z, r, g, b, size, motionx, motiony, motionz, 1F);
}
void wispFX(double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul);
default void lightningFX(Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, int colorOuter, int colorInner) {
lightningFX(vectorStart, vectorEnd, ticksPerMeter, System.nanoTime(), colorOuter, colorInner);
}
@@ -81,4 +50,7 @@ public interface IProxy {
int getClientRenderDistance();
Object getEmptyModelBiped();
// Side-safe version of world.addParticle with noDistanceLimit flag set to true
default void addParticleForce(World world, IParticleData particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {}
}
@@ -15,7 +15,6 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
@@ -71,24 +70,6 @@ public class ServerProxy implements IProxy {
return ServerLifecycleHooks.getCurrentServer().getWorld(DimensionType.OVERWORLD).getGameTime();
}
@Override
public void setSparkleFXNoClip(boolean noclip) {}
@Override
public void setSparkleFXCorrupt(boolean corrupt) {}
@Override
public void sparkleFX(double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {}
@Override
public void setWispFXDistanceLimit(boolean limit) {}
@Override
public void setWispFXDepthTest(boolean depth) {}
@Override
public void wispFX(double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) {}
@Override
public void lightningFX(Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {}
@@ -0,0 +1,52 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.common.crafting;
import com.google.gson.JsonObject;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.crafting.conditions.ICondition;
import net.minecraftforge.common.crafting.conditions.IConditionSerializer;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.lib.LibMisc;
public class FluxfieldCondition implements ICondition {
public static final ResourceLocation KEY = new ResourceLocation(LibMisc.MOD_ID, "fluxfield_enabled");
private final boolean value;
public FluxfieldCondition(boolean value) {
this.value = value;
}
@Override
public ResourceLocation getID() {
return KEY;
}
@Override
public boolean test() {
return ConfigHandler.COMMON.fluxfieldEnabled.get() == value;
}
public static final IConditionSerializer<FluxfieldCondition> SERIALIZER = new IConditionSerializer<FluxfieldCondition>() {
@Override
public void write(JsonObject json, FluxfieldCondition cond) {
json.addProperty("value", cond.value);
}
@Override
public FluxfieldCondition read(JsonObject json) {
return new FluxfieldCondition(json.get("value").getAsBoolean());
}
@Override
public ResourceLocation getID() {
return KEY;
}
};
}
@@ -1,31 +0,0 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.common.crafting;
import com.google.gson.JsonObject;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.crafting.IConditionSerializer;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.function.BooleanSupplier;
public class FluxfieldConditionFactory implements IConditionSerializer {
public static final ResourceLocation KEY = new ResourceLocation(LibMisc.MOD_ID, "fluxfield_enabled");
@Nonnull
@Override
public BooleanSupplier parse(@Nonnull JsonObject json) {
boolean value = JSONUtils.getBoolean(json , "value", true);
return () -> ConfigHandler.COMMON.fluxfieldEnabled.get() == value;
}
}
@@ -1,51 +0,0 @@
package vazkii.botania.common.crafting;
import com.google.gson.JsonObject;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.crafting.IIngredientSerializer;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import javax.annotation.Nullable;
import java.util.stream.Stream;
// Like Forge IngredientNBT but does subset checking instead of exact match for NBT tags
public class IngredientNBTSubset extends Ingredient {
private final ItemStack stack;
public IngredientNBTSubset(ItemStack stack) {
super(Stream.of(new Ingredient.SingleItemList(stack)));
this.stack = stack;
}
@Override
public boolean test(@Nullable ItemStack input) {
if(input == null)
return false;
return stack.getItem() == input.getItem() && ItemNBTHelper.isTagSubset(stack.getTag(), input.getTag());
}
@Override
public boolean isSimple() {
return false;
}
public static class Serializer implements IIngredientSerializer<IngredientNBTSubset> {
@Override
public IngredientNBTSubset parse(PacketBuffer buffer) {
return new IngredientNBTSubset(buffer.readItemStack());
}
@Override
public IngredientNBTSubset parse(JsonObject json) {
return new IngredientNBTSubset(CraftingHelper.getItemStack(json, true));
}
@Override
public void write(PacketBuffer buffer, IngredientNBTSubset ingredient) {
buffer.writeItemStack(ingredient.stack);
}
}
}
@@ -39,8 +39,8 @@ public class LensDyeingRecipe extends SpecialRecipe {
Ingredient.fromTag(Tags.Items.DYES_PINK), Ingredient.fromTag(Tags.Items.DYES_GRAY),
Ingredient.fromTag(Tags.Items.DYES_LIGHT_GRAY), Ingredient.fromTag(Tags.Items.DYES_CYAN),
Ingredient.fromTag(Tags.Items.DYES_PURPLE), Ingredient.fromTag(Tags.Items.DYES_BLUE),
Ingredient.fromTag(Tags.Items.DYES_BROWN), Ingredient.fromTag(Tags.Items.DYES_RED),
Ingredient.fromTag(Tags.Items.DYES_GREEN), Ingredient.fromTag(Tags.Items.DYES_BLACK),
Ingredient.fromTag(Tags.Items.DYES_BROWN), Ingredient.fromTag(Tags.Items.DYES_GREEN),
Ingredient.fromTag(Tags.Items.DYES_RED), Ingredient.fromTag(Tags.Items.DYES_BLACK),
Ingredient.fromItems(ModItems.manaPearl)
);
@@ -29,7 +29,7 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.core.helper.Vector3;
@@ -159,8 +159,10 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
setMotion(mot);
if(liveTime > delay)
Botania.proxy.wispFX(posX, posY, posZ, 1F, 1F, 0F, 0.3F, 0F);
if(liveTime > delay) {
WispParticleData data = WispParticleData.wisp(0.3F, 1F, 1F, 0F, 1);
world.addParticle(data, posX, posY, posZ, 0, -0F, 0);
}
if(liveTime > 200 + delay)
remove();
@@ -10,6 +10,7 @@
*/
package vazkii.botania.common.entity;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@@ -20,8 +21,6 @@ import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.goal.SwimGoal;
import net.minecraft.entity.ai.goal.LookAtGoal;
import net.minecraft.entity.monster.SkeletonEntity;
import net.minecraft.entity.monster.WitchEntity;
import net.minecraft.entity.monster.WitherSkeletonEntity;
import net.minecraft.entity.monster.ZombieEntity;
import net.minecraft.entity.player.PlayerEntity;
@@ -50,7 +49,6 @@ import net.minecraft.util.SoundEvents;
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.ITextComponent;
import net.minecraft.util.text.Style;
@@ -74,6 +72,7 @@ import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
import vazkii.botania.client.core.handler.BossBarHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.advancements.DopplegangerNoArmorTrigger;
import vazkii.botania.common.block.ModBlocks;
@@ -124,12 +123,12 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
private static final DataParameter<Integer> INVUL_TIME = EntityDataManager.createKey(EntityDoppleganger.class, DataSerializers.VARINT);
private static final BlockPos[] PYLON_LOCATIONS = {
private static final List<BlockPos> PYLON_LOCATIONS = ImmutableList.of(
new BlockPos(4, 1, 4),
new BlockPos(4, 1, -4),
new BlockPos(-4, 1, 4),
new BlockPos(-4, 1, -4)
};
);
private static final List<ResourceLocation> CHEATY_BLOCKS = Arrays.asList(
new ResourceLocation("openblocks", "beartrap"),
@@ -195,25 +194,22 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
}
//check pylons
for(BlockPos coords : PYLON_LOCATIONS) {
BlockPos pos_ = pos.add(coords);
BlockState state = world.getBlockState(pos_);
if(state.getBlock() != ModBlocks.gaiaPylon) {
if(!world.isRemote)
player.sendMessage(new TranslationTextComponent("botaniamisc.needsCatalysts").setStyle(new Style().setColor(TextFormatting.RED)));
return false;
List<BlockPos> invalidPylonBlocks = checkPylons(world, pos);
if(!invalidPylonBlocks.isEmpty()) {
if(world.isRemote) {
warnInvalidBlocks(world, invalidPylonBlocks);
} else {
player.sendMessage(new TranslationTextComponent("botaniamisc.needsCatalysts").setStyle(new Style().setColor(TextFormatting.RED)));
}
return false;
}
//check arena shape
List<BlockPos> invalidArenaBlocks = checkArena(world, pos);
if(!invalidArenaBlocks.isEmpty()) {
if(world.isRemote) {
Botania.proxy.setWispFXDepthTest(false);
for(BlockPos pos_ : invalidArenaBlocks)
Botania.proxy.wispFX(pos_.getX() + 0.5, pos_.getY() + 0.5, pos_.getZ() + 0.5, 1F, 0.2F, 0.2F, 0.5F, 0F, 8);
Botania.proxy.setWispFXDepthTest(true);
warnInvalidBlocks(world, invalidArenaBlocks);
} else {
PacketHandler.sendTo((ServerPlayerEntity) player,
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.ARENA_INDICATOR, pos.getX(), pos.getY(), pos.getZ()));
@@ -250,6 +246,21 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
return true;
}
private static List<BlockPos> checkPylons(World world, BlockPos beaconPos) {
List<BlockPos> invalidPylonBlocks = new ArrayList<>();
for(BlockPos coords : PYLON_LOCATIONS) {
BlockPos pos_ = beaconPos.add(coords);
BlockState state = world.getBlockState(pos_);
if(state.getBlock() != ModBlocks.gaiaPylon) {
invalidPylonBlocks.add(pos_);
}
}
return invalidPylonBlocks;
}
private static List<BlockPos> checkArena(World world, BlockPos beaconPos) {
List<BlockPos> trippedPositions = new ArrayList<>();
int range = (int) Math.ceil(ARENA_RANGE);
@@ -260,24 +271,40 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
if(Math.abs(x) == 4 && Math.abs(z) == 4 || vazkii.botania.common.core.helper.MathHelper.pointDistancePlane(x, z, 0, 0) > ARENA_RANGE)
continue; // Ignore pylons and out of circle
for(int y = -1; y <= ARENA_HEIGHT; y++) {
boolean hasFloor = false;
for(int y = -2; y <= ARENA_HEIGHT; y++) {
if(x == 0 && y == 0 && z == 0)
continue; //this is the beacon
continue; //the beacon
pos = beaconPos.add(x, y, z);
boolean expectedBlockHere = y == -1; //the floor
boolean isBlockHere = !world.getBlockState(pos).getCollisionShape(world, pos).isEmpty();
BlockState state = world.getBlockState(pos);
if(expectedBlockHere != isBlockHere) {
boolean allowBlockHere = y < 0;
boolean isBlockHere = !state.getCollisionShape(world, pos).isEmpty();
if(allowBlockHere && isBlockHere) //floor is here! good
hasFloor = true;
if(y == 0 && !hasFloor) //column is entirely missing floor
trippedPositions.add(pos.down());
if(!allowBlockHere && isBlockHere && !BLACKLIST.contains(state.getBlock())) //ceiling is obstructed in this column
trippedPositions.add(pos);
}
}
}
return trippedPositions;
}
private static void warnInvalidBlocks(World world, Iterable<BlockPos> invalidPositions) {
WispParticleData data = WispParticleData.wisp(0.5F, 1, 0.2F, 0.2F, 8, false);
for(BlockPos pos_ : invalidPositions) {
world.addParticle(data, pos_.getX() + 0.5, pos_.getY() + 0.5, pos_.getZ() + 0.5, 0, 0, 0);
}
}
@Override
protected void registerGoals() {
goalSelector.addGoal(0, new SwimGoal(this));
@@ -505,7 +532,8 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
double y = source.getY() + 0.5;
double z = source.getZ() + 0.5 - Math.sin(rad) * ARENA_RANGE;
Botania.proxy.wispFX(x, y, z, r, g, b, 0.5F, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * mv, (float) (Math.random() - 0.5F) * m);
WispParticleData data = WispParticleData.wisp(0.5F, r, g, b);
world.addParticle(data, x, y, z, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * mv, (float) (Math.random() - 0.5F) * m);
}
if(getInvulTime() > 10) {
@@ -526,8 +554,10 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
float g = (float) Math.random() * 0.3F;
float b = 0.7F + (float) Math.random() * 0.3F;
Botania.proxy.wispFX(partPos.x, partPos.y, partPos.z, r, g, b, 0.25F + (float) Math.random() * 0.1F, -0.075F - (float) Math.random() * 0.015F);
Botania.proxy.wispFX(partPos.x, partPos.y, partPos.z, r, g, b, 0.4F, (float) mot.x, (float) mot.y, (float) mot.z);
WispParticleData data = WispParticleData.wisp(0.25F + (float) Math.random() * 0.1F, r, g, b, 1);
world.addParticle(data, partPos.x, partPos.y, partPos.z, 0, -(-0.075F - (float) Math.random() * 0.015F), 0);
WispParticleData data1 = WispParticleData.wisp(0.4F, r, g, b);
world.addParticle(data1, partPos.x, partPos.y, partPos.z, (float) mot.x, (float) mot.y, (float) mot.z);
}
}
}
@@ -552,7 +582,7 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
//don't break blacklisted blocks
if(BLACKLIST.contains(block)) continue;
//don't break the floor
if(y == source.getY() - 1) continue;
if(y < source.getY()) continue;
//don't break blocks in pylon columns
if(Math.abs(source.getX() - x) == 4 && Math.abs(source.getZ() - z) == 4) continue;
@@ -812,12 +842,11 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
private void teleportRandomly() {
//choose a location to teleport to
double oldX = posX, oldY = posY, oldZ = posZ;
double newX, newY, newZ;
double newX, newY = source.getY(), newZ;
int tries = 0;
do {
newX = source.getX() + (rand.nextDouble() - .5) * ARENA_RANGE;
newY = source.getY();
newZ = source.getZ() + (rand.nextDouble() - .5) * ARENA_RANGE;
tries++;
//ensure it's inside the arena ring, and not just its bounding square
@@ -830,6 +859,12 @@ public class EntityDoppleganger extends MobEntity implements IBotaniaBoss, IEnti
newY = source.getY() + 1.6;
newZ = source.getZ() + .5;
}
//for low-floor arenas, ensure landing on the ground
BlockPos tentativeFloorPos = new BlockPos(newX, newY - 1, newZ);
if(world.getBlockState(tentativeFloorPos).getCollisionShape(world, tentativeFloorPos).isEmpty()) {
newY--;
}
//teleport there
setPositionAndUpdate(newX, newY, newZ);
@@ -24,7 +24,7 @@ import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.core.handler.ConfigHandler;
import java.util.List;
@@ -51,11 +51,12 @@ public class EntityFallingStar extends EntityThrowableCopy {
super.tick();
float dist = 1.5F;
SparkleParticleData data = SparkleParticleData.sparkle(2F, 1F, 0.4F, 1F, 6);
for(int i = 0; i < 10; i++) {
float xs = (float) (Math.random() - 0.5) * dist;
float ys = (float) (Math.random() - 0.5) * dist;
float zs = (float) (Math.random() - 0.5) * dist;
Botania.proxy.sparkleFX(posX + xs, posY + ys, posZ + zs, 1F, 0.4F, 1F, 2F, 6);
world.addParticle(data, posX + xs, posY + ys, posZ + zs, 0, 0, 0);
}
LivingEntity thrower = getThrower();
@@ -13,19 +13,16 @@ package vazkii.botania.common.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.util.SoundEvents;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.DamageSource;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.core.helper.MathHelper;
import javax.annotation.Nonnull;
@@ -66,14 +63,16 @@ public class EntityFlameRing extends Entity {
double x = Math.cos(rad) * renderRadius;
double z = Math.sin(rad) * renderRadius;
Botania.proxy.wispFX(posX + x, posY - 0.2, posZ + z, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 0.65F + (float) Math.random() * 0.45F, (float) (Math.random() - 0.5F) * 0.15F, 0.055F + (float) Math.random() * 0.025F, (float) (Math.random() - 0.5F) * 0.15F);
WispParticleData data1 = WispParticleData.wisp(0.65F + (float) Math.random() * 0.45F, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F);
world.addParticle(data1, posX + x, posY - 0.2, posZ + z, (float) (Math.random() - 0.5F) * 0.15F, 0.055F + (float) Math.random() * 0.025F, (float) (Math.random() - 0.5F) * 0.15F);
float gs = (float) Math.random() * 0.15F;
float smokeRadius = (float) (renderRadius - Math.random() * renderRadius * 0.9);
x = Math.cos(rad) * smokeRadius;
z = Math.sin(rad) * smokeRadius;
Botania.proxy.wispFX(posX + x, posY - 0.2, posZ + z, gs, gs, gs, 0.65F + (float) Math.random() * 0.45F, -0.155F - (float) Math.random() * 0.025F);
}
WispParticleData data = WispParticleData.wisp(0.65F + (float) Math.random() * 0.45F, gs, gs, gs, 1);
world.addParticle(data, posX + x, posY - 0.2, posZ + z, 0, -(-0.155F - (float) Math.random() * 0.025F), 0);
}
}
if(world.rand.nextInt(20) == 0)
@@ -13,11 +13,9 @@ package vazkii.botania.common.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.potion.Effects;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.EffectInstance;
import net.minecraft.util.DamageSource;
import net.minecraft.util.SoundCategory;
@@ -26,7 +24,7 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.core.handler.ModSounds;
import javax.annotation.Nonnull;
@@ -61,16 +59,20 @@ public class EntityMagicLandmine extends Entity {
float b = 0.2F;
//Botania.proxy.wispFX(world, posX, posY, posZ, r, g, b, 0.6F, -0.2F, 1);
for(int i = 0; i < 6; i++)
Botania.proxy.wispFX(posX - range + Math.random() * range * 2, posY, posZ - range + Math.random() * range * 2, r, g, b, 0.4F, -0.015F, 1);
for(int i = 0; i < 6; i++) {
WispParticleData data = WispParticleData.wisp(0.4F, r, g, b, (float) 1);
world.addParticle(data, posX - range + Math.random() * range * 2, posY, posZ - range + Math.random() * range * 2, 0, - -0.015F, 0);
}
if(ticksExisted >= 55) {
world.playSound(null, posX, posY, posZ, ModSounds.gaiaTrap, SoundCategory.NEUTRAL, 0.3F, 1F);
float m = 0.35F;
g = 0.4F;
for(int i = 0; i < 25; i++)
Botania.proxy.wispFX(posX, posY + 1, posZ, r, g, b, 0.5F, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * m);
for(int i = 0; i < 25; i++) {
WispParticleData data = WispParticleData.wisp(0.5F, r, g, b);
world.addParticle(data, posX, posY + 1, posZ, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * m);
}
if(!world.isRemote) {
List<PlayerEntity> players = world.getEntitiesWithinAABB(PlayerEntity.class, new AxisAlignedBB(posX - range, posY - range, posZ - range, posX + range, posY + range, posZ + range));
@@ -31,6 +31,7 @@ import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.lib.LibMisc;
@@ -110,15 +111,16 @@ public class EntityMagicMissile extends ThrowableEntity {
int steps = (int) (diff.mag() / step.mag());
Vector3 particlePos = oldPos;
Botania.proxy.setSparkleFXCorrupt(evil);
SparkleParticleData data = evil ? SparkleParticleData.corrupt(0.8F, 1F, 0.0F, 1F, 2)
: SparkleParticleData.sparkle(0.8F, 1F, 0.4F, 1F, 2);
for(int i = 0; i < steps; i++) {
Botania.proxy.sparkleFX(particlePos.x, particlePos.y, particlePos.z, 1F, evil ? 0F : 0.4F, 1F, 0.8F, 2);
world.addParticle(data, particlePos.x, particlePos.y, particlePos.z, 0, 0, 0);
if(world.rand.nextInt(steps) <= 1)
Botania.proxy.sparkleFX(particlePos.x + (Math.random() - 0.5) * 0.4, particlePos.y + (Math.random() - 0.5) * 0.4, particlePos.z + (Math.random() - 0.5) * 0.4, 1F, evil ? 0F : 0.4F, 1F, 0.8F, 2);
world.addParticle(data, particlePos.x + (Math.random() - 0.5) * 0.4, particlePos.y + (Math.random() - 0.5) * 0.4, particlePos.z + (Math.random() - 0.5) * 0.4, 0, 0, 0);
particlePos = particlePos.add(step);
}
Botania.proxy.setSparkleFXCorrupt(false);
LivingEntity target = getTargetEntity();
if(target != null) {
@@ -31,6 +31,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.ProjectileHelper;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.block.Blocks;
import net.minecraft.network.IPacket;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
@@ -49,6 +50,7 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaBurst;
@@ -62,6 +64,8 @@ import vazkii.botania.api.mana.IManaSpreader;
import vazkii.botania.api.mana.IManaTrigger;
import vazkii.botania.api.mana.IPingable;
import vazkii.botania.api.mana.IThrottledPacket;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.Vector3;
@@ -213,11 +217,10 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
}
*/
if (!scanBeam && !world.isRemote() && // Botania - collide only on server and non scanbeam
raytraceresult.getType() != RayTraceResult.Type.MISS) {
if (raytraceresult.getType() != RayTraceResult.Type.MISS) {
if (raytraceresult.getType() == RayTraceResult.Type.BLOCK && this.world.getBlockState(((BlockRayTraceResult)raytraceresult).getPos()).getBlock() == Blocks.NETHER_PORTAL) {
this.setPortal(((BlockRayTraceResult)raytraceresult).getPos());
} else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)){
} else if (!net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) {
this.onImpact(raytraceresult);
}
}
@@ -440,16 +443,17 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
else if(fullManaLastTick)
size = 4F;
if(!noParticles && shouldDoFakeParticles())
Botania.proxy.sparkleFX(posX, posY, posZ, r, g, b, 0.4F * size, 1, true);
if(!noParticles && shouldDoFakeParticles()) {
SparkleParticleData data = SparkleParticleData.fake(0.4F * size, r, g, b, 1);
Botania.proxy.addParticleForce(world, data, posX, posY, posZ, 0, 0, 0);
}
} else {
boolean monocle = Botania.proxy.isClientPlayerWearingMonocle();
if(monocle)
Botania.proxy.setWispFXDepthTest(false);
boolean depth = !Botania.proxy.isClientPlayerWearingMonocle();
if(ConfigHandler.CLIENT.subtlePowerSystem.get())
Botania.proxy.wispFX(posX, posY, posZ, r, g, b, 0.1F * size, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.01F);
else {
if(ConfigHandler.CLIENT.subtlePowerSystem.get()) {
WispParticleData data = WispParticleData.wisp(0.1F * size, r, g, b, depth);
world.addParticle(data, posX, posY, posZ, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.01F);
} else {
float or = r;
float og = g;
float ob = b;
@@ -474,7 +478,8 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
b = ob + (float) Math.random() * 0.125F;
}
size = osize + ((float) Math.random() - 0.5F) * 0.065F + (float) Math.sin(new Random(entityUniqueID.getMostSignificantBits()).nextInt(9001)) * 0.4F;
Botania.proxy.wispFX(posX, posY, posZ, r, g, b, 0.2F * size,
WispParticleData data = WispParticleData.wisp(0.2F * size, r, g, b, depth);
world.addParticle(data, posX, posY, posZ,
(float) -getMotion().getX() * 0.01F,
(float) -getMotion().getY() * 0.01F,
(float) -getMotion().getZ() * 0.01F);
@@ -485,19 +490,17 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
currentPos = Vector3.fromEntity(this);
diffVec = oldPos.subtract(currentPos);
if(getEntityData().contains(ItemTinyPlanet.TAG_ORBIT))
if(getPersistentData().contains(ItemTinyPlanet.TAG_ORBIT))
break;
} while(Math.abs(diffVec.mag()) > distance);
Botania.proxy.wispFX(posX, posY, posZ, or, og, ob, 0.1F * size, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F);
WispParticleData data = WispParticleData.wisp(0.1F * size, or, og, ob, depth);
world.addParticle(data, posX, posY, posZ, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F, (float) (Math.random() - 0.5F) * 0.06F);
posX = savedPosX;
posY = savedPosY;
posZ = savedPosZ;
}
if(monocle)
Botania.proxy.setWispFXDepthTest(true);
}
}
@@ -564,9 +567,12 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
float size = (float) mana / (float) maxMana;
if(!ConfigHandler.CLIENT.subtlePowerSystem.get())
for(int i = 0; i < 4; i++)
Botania.proxy.wispFX(posX, posY, posZ, r, g, b, 0.15F * size, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F);
Botania.proxy.sparkleFX((float) posX, (float) posY, (float) posZ, r, g, b, 4, 2);
for(int i = 0; i < 4; i++) {
WispParticleData data = WispParticleData.wisp(0.15F * size, r, g, b);
world.addParticle(data, posX, posY, posZ, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F);
}
SparkleParticleData data = SparkleParticleData.sparkle((float) 4, r, g, b, 2);
world.addParticle(data, (float) posX, (float) posY, (float) posZ, 0, 0, 0);
}
remove();
@@ -756,6 +762,12 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
((IPingable) tile).pingback(this, getShooterUUID());
}
@Nonnull
@Override
public IPacket<?> createSpawnPacket() {
return NetworkHooks.getEntitySpawningPacket(this);
}
protected boolean shouldDoFakeParticles() {
if (ConfigHandler.CLIENT.staticWandBeam.get())
return true;
@@ -13,19 +13,16 @@ package vazkii.botania.common.entity;
import net.minecraft.entity.FlyingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.EffectInstance;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import javax.annotation.Nonnull;
@@ -129,15 +126,22 @@ public class EntityPixie extends FlyingEntity {
boolean dark = getPixieType() == 1;
if(world.isRemote)
for(int i = 0; i < 4; i++)
Botania.proxy.sparkleFX(posX + (Math.random() - 0.5) * 0.25, posY + 0.5 + (Math.random() - 0.5) * 0.25, posZ + (Math.random() - 0.5) * 0.25, dark ? 0.1F : 1F, dark ? 0.025F : 0.25F, dark ? 0.09F : 0.9F, 0.1F + (float) Math.random() * 0.25F, 12);
for(int i = 0; i < 4; i++) {
float r = dark ? 0.1F : 1F;
float g = dark ? 0.025F : 0.25F;
float b = dark ? 0.09F : 0.9F;
SparkleParticleData data = SparkleParticleData.sparkle(0.1F + (float) Math.random() * 0.25F, r, g, b, 12);
world.addParticle(data, posX + (Math.random() - 0.5) * 0.25, posY + 0.5 + (Math.random() - 0.5) * 0.25, posZ + (Math.random() - 0.5) * 0.25, 0, 0, 0);
}
}
@Override
public void remove() {
if(world != null && world.isRemote && getPixieType() == 0)
for(int i = 0; i < 12; i++)
Botania.proxy.sparkleFX(posX + (Math.random() - 0.5) * 0.25, posY + 0.5 + (Math.random() - 0.5) * 0.25, posZ + (Math.random() - 0.5) * 0.25, 1F, 0.25F, 0.9F, 1F + (float) Math.random() * 0.25F, 5);
for(int i = 0; i < 12; i++) {
SparkleParticleData data = SparkleParticleData.sparkle(1F + (float) Math.random() * 0.25F, 1F, 0.25F, 0.9F, 5);
world.addParticle(data, posX + (Math.random() - 0.5) * 0.25, posY + 0.5 + (Math.random() - 0.5) * 0.25, posZ + (Math.random() - 0.5) * 0.25, 0, 0, 0);
}
super.remove();
}
@@ -30,7 +30,7 @@ import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.mana.TilePool;
import vazkii.botania.common.block.tile.mana.TilePump;
@@ -118,8 +118,10 @@ public class EntityPoolMinecart extends AbstractMinecartEntity {
double x = MathHelper.floor(posX);
double y = MathHelper.floor(posY);
double z = MathHelper.floor(posZ);
if(Math.random() > particleChance)
Botania.proxy.wispFX(x + 0.3 + Math.random() * 0.5, y + 0.85 + Math.random() * 0.25, z + Math.random(), color.getRed(), color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random() / 3F, (float) -Math.random() / 25F, 2F);
if(Math.random() > particleChance) {
WispParticleData data = WispParticleData.wisp((float) Math.random() / 3F, (float) color.getRed(), color.getGreen() / 255F, color.getBlue() / 255F, 2F);
world.addParticle(data, x + 0.3 + Math.random() * 0.5, y + 0.85 + Math.random() * 0.25, z + Math.random(), 0, (float) Math.random() / 25F, 0);
}
}
}
@@ -16,14 +16,13 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.util.SoundEvents;
import net.minecraft.item.DyeColor;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.datasync.DataParameter;
import net.minecraft.network.datasync.DataSerializers;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.util.SoundEvents;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lib.LibMisc;
@@ -68,13 +67,15 @@ public class EntitySignalFlare extends Entity {
int g = (hex & 0xFF00) >> 8;
int b = hex & 0xFF;
Botania.proxy.setWispFXDistanceLimit(false);
for(int i = 0; i < 3; i++)
Botania.proxy.wispFX(posX, posY, posZ + 0.5, r / 255F, g / 255F, b / 255F, (float) Math.random() * 5 + 1F, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - (float) posY)), (float) (Math.random() - 0.5F));
for(int i = 0; i < 3; i++) {
WispParticleData data = WispParticleData.wisp((float) Math.random() * 5 + 1F, r / 255F, g / 255F, b / 255F);
Botania.proxy.addParticleForce(world, data, posX, posY, posZ + 0.5, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - (float) posY)), (float) (Math.random() - 0.5F));
}
for(int i = 0; i < 4; i++)
Botania.proxy.wispFX(posX + 0.5, Math.min(256, getFiredAt() + Botania.proxy.getClientRenderDistance() * 16), posZ + 0.5, r / 255F, g / 255F, b / 255F, (float) Math.random() * 15 + 8F, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F);
Botania.proxy.setWispFXDistanceLimit(true);
for(int i = 0; i < 4; i++) {
WispParticleData data = WispParticleData.wisp((float) Math.random() * 15 + 8F, r / 255F, g / 255F, b / 255F);
Botania.proxy.addParticleForce(world, data, posX + 0.5, Math.min(256, getFiredAt() + Botania.proxy.getClientRenderDistance() * 16), posZ + 0.5, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F);
}
}
}
}
@@ -25,6 +25,7 @@ public final class ModEntities {
public static void registerEntities(RegistryEvent.Register<EntityType<?>> evt) {
evt.getRegistry().register(EntityType.Builder.<EntityManaBurst>create(
EntityManaBurst::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityManaBurst(w))
.size(0, 0)
.setUpdateInterval(10)
.setTrackingRange(64)
@@ -33,6 +34,7 @@ public final class ModEntities {
.setRegistryName(LibEntityNames.MANA_BURST));
evt.getRegistry().register(EntityType.Builder.<EntitySignalFlare>create(
EntitySignalFlare::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntitySignalFlare(w))
.size(0, 0)
.setUpdateInterval(10)
.setTrackingRange(2048)
@@ -40,6 +42,7 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.SIGNAL_FLARE));
evt.getRegistry().register(EntityType.Builder.<EntityPixie>create(EntityPixie::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityPixie(w))
.size(1, 1)
.setUpdateInterval(3)
.setTrackingRange(16)
@@ -47,6 +50,7 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.PIXIE));
evt.getRegistry().register(EntityType.Builder.<EntityFlameRing>create(EntityFlameRing::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityFlameRing(w))
.size(0, 0)
.setTrackingRange(32)
.setUpdateInterval(40)
@@ -54,12 +58,14 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.FLAME_RING));
evt.getRegistry().register(EntityType.Builder.<EntityVineBall>create(EntityVineBall::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityVineBall(w))
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.VINE_BALL));
evt.getRegistry().register(EntityType.Builder.<EntityDoppleganger>create(EntityDoppleganger::new, EntityClassification.MONSTER)
.setCustomClientFactory((p, w) -> new EntityDoppleganger(w))
.size(0.6F, 1.8F)
.immuneToFire()
.setTrackingRange(128)
@@ -68,6 +74,7 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.DOPPLEGANGER));
evt.getRegistry().register(EntityType.Builder.<EntityMagicLandmine>create(EntityMagicLandmine::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityMagicLandmine(w))
.size(0, 0)
.setTrackingRange(128)
.setUpdateInterval(40)
@@ -75,6 +82,7 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.MAGIC_LANDMINE));
evt.getRegistry().register(EntityType.Builder.<EntitySpark>create(EntitySpark::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntitySpark(w))
.size(0.1F, 0.5F)
.immuneToFire()
.setTrackingRange(64)
@@ -83,6 +91,7 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.SPARK));
evt.getRegistry().register(EntityType.Builder.<EntityThrownItem>create(EntityThrownItem::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityThrownItem(w))
.size(0.25F, 0.25F)
.setTrackingRange(64)
.setUpdateInterval(20)
@@ -90,6 +99,7 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.THROWN_ITEM));
evt.getRegistry().register(EntityType.Builder.<EntityMagicMissile>create(EntityMagicMissile::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityMagicMissile(w))
.size(0, 0)
.setTrackingRange(64)
.setUpdateInterval(2)
@@ -97,12 +107,14 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.MAGIC_MISSILE));
evt.getRegistry().register(EntityType.Builder.<EntityThornChakram>create(EntityThornChakram::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityThornChakram(EntityThornChakram.TYPE, w))
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(true)
.build("")
.setRegistryName(LibEntityNames.THORN_CHAKRAM));
evt.getRegistry().register(EntityType.Builder.<EntityCorporeaSpark>create(EntityCorporeaSpark::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityCorporeaSpark(w))
.size(0.1F, 0.5F)
.immuneToFire()
.setTrackingRange(64)
@@ -111,6 +123,7 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.CORPOREA_SPARK));
evt.getRegistry().register(EntityType.Builder.<EntityEnderAirBottle>create(EntityEnderAirBottle::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityEnderAirBottle(EntityEnderAirBottle.TYPE, w))
.size(0.25F, 0.25F)
.setTrackingRange(64)
.setUpdateInterval(10)
@@ -118,6 +131,7 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.ENDER_AIR_BOTTLE));
evt.getRegistry().register(EntityType.Builder.<EntityPoolMinecart>create(EntityPoolMinecart::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityPoolMinecart(EntityPoolMinecart.TYPE, w))
.size(0.98F, 0.7F)
.setTrackingRange(80)
.setUpdateInterval(3)
@@ -125,6 +139,7 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.POOL_MINECART));
evt.getRegistry().register(EntityType.Builder.<EntityPinkWither>create(EntityPinkWither::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityPinkWither(w))
.size(0.9F, 3.5F)
.setTrackingRange(80)
.setUpdateInterval(3)
@@ -132,6 +147,7 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.PINK_WITHER));
evt.getRegistry().register(EntityType.Builder.<EntityPlayerMover>create(EntityPlayerMover::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityPlayerMover(EntityPlayerMover.TYPE, w))
.size(0, 0)
.setTrackingRange(40)
.setUpdateInterval(3)
@@ -139,12 +155,14 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.PLAYER_MOVER));
evt.getRegistry().register(EntityType.Builder.<EntityManaStorm>create(EntityManaStorm::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityManaStorm(w))
.setTrackingRange(64)
.setUpdateInterval(10)
.setShouldReceiveVelocityUpdates(false)
.build("")
.setRegistryName(LibEntityNames.MANA_STORM));
evt.getRegistry().register(EntityType.Builder.<EntityBabylonWeapon>create(EntityBabylonWeapon::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityBabylonWeapon(EntityBabylonWeapon.TYPE, w))
.size(0, 0)
.setTrackingRange(64)
.setUpdateInterval(10)
@@ -152,6 +170,7 @@ public final class ModEntities {
.build("")
.setRegistryName(LibEntityNames.BABYLON_WEAPON));
evt.getRegistry().register(EntityType.Builder.<EntityFallingStar>create(EntityFallingStar::new, EntityClassification.MISC)
.setCustomClientFactory((p, w) -> new EntityFallingStar(EntityFallingStar.TYPE, w))
.size(0, 0)
.setTrackingRange(64)
.setUpdateInterval(10)
@@ -13,61 +13,39 @@ package vazkii.botania.common.item;
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.AbstractGui;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.block.Blocks;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.SimpleNamedContainerProvider;
import net.minecraft.inventory.container.WorkbenchContainer;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.WorkbenchContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
@@ -75,16 +53,14 @@ import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.wrapper.EmptyHandler;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.client.gui.crafting.ContainerCraftingHalo;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.lib.LibGuiIDs;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Optional;
@@ -218,8 +194,10 @@ public class ItemCraftingHalo extends ItemMod {
Vec3d lookVec3 = player.getLookVec();
Vector3 centerVector = Vector3.fromEntityCenter(player).add(lookVec3.x * 3, 1.3, lookVec3.z * 3);
float m = 0.1F;
for(int i = 0; i < 4; i++)
Botania.proxy.wispFX(centerVector.x, centerVector.y, centerVector.z, 1F, 0F, 1F, 0.2F + 0.2F * (float) Math.random(), ((float) Math.random() - 0.5F) * m, ((float) Math.random() - 0.5F) * m, ((float) Math.random() - 0.5F) * m);
for(int i = 0; i < 4; i++) {
WispParticleData data = WispParticleData.wisp(0.2F + 0.2F * (float) Math.random(), 1F, 0F, 1F);
player.world.addParticle(data, centerVector.x, centerVector.y, centerVector.z, ((float) Math.random() - 0.5F) * m, ((float) Math.random() - 0.5F) * m, ((float) Math.random() - 0.5F) * m);
}
}
private static boolean consumeRecipeIngredients(ItemStack[] recipe, IItemHandler inv, PlayerEntity player) {
@@ -10,20 +10,13 @@
*/
package vazkii.botania.common.item;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.lib.LibItemNames;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@@ -69,8 +62,9 @@ public class ItemFertilizer extends ItemMod {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.wispFX(x, y, z, red, green, blue, 0.15F + (float) Math.random() * 0.25F, -(float) Math.random() * 0.1F - 0.05F);
}
WispParticleData data = WispParticleData.wisp(0.15F + (float) Math.random() * 0.25F, red, green, blue, 1);
world.addParticle(data, x, y, z, 0, (float) Math.random() * 0.1F - 0.05F, 0);
}
}
return ActionResultType.SUCCESS;
@@ -13,41 +13,27 @@ package vazkii.botania.common.item;
import com.google.common.collect.ImmutableMap;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.LogicalSide;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.api.item.IFloatingFlower.IslandType;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.handler.ModelHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
@@ -109,8 +95,12 @@ public class ItemGrassSeeds extends ItemMod implements IFloatingFlowerVariant {
double z = (Math.random() - 0.5) * 3;
float velMul = 0.025F;
Botania.proxy.wispFX(pos.getX() + 0.5 + x, pos.getY() + 0.5 + y, pos.getZ() + 0.5 + z, r, g, b, (float) Math.random() * 0.15F + 0.15F, (float) -x * velMul, (float) -y * velMul, (float) -z * velMul);
}
float motionx = (float) -x * velMul;
float motiony = (float) -y * velMul;
float motionz = (float) -z * velMul;
WispParticleData data = WispParticleData.wisp((float) Math.random() * 0.15F + 0.15F, r, g, b);
world.addParticle(data, pos.getX() + 0.5 + x, pos.getY() + 0.5 + y, pos.getZ() + 0.5 + z, motionx, motiony, motionz);
}
}
return ActionResultType.SUCCESS;
@@ -67,7 +67,7 @@ public class ItemKeepIvy extends ItemMod {
i++;
}
CompoundNBT data = event.getEntityLiving().getEntityData();
CompoundNBT data = event.getEntityLiving().getPersistentData();
if(!data.contains(PlayerEntity.PERSISTED_NBT_TAG))
data.put(PlayerEntity.PERSISTED_NBT_TAG, new CompoundNBT());
@@ -78,7 +78,7 @@ public class ItemKeepIvy extends ItemMod {
@SubscribeEvent
public static void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) {
CompoundNBT data = event.getPlayer().getEntityData();
CompoundNBT data = event.getPlayer().getPersistentData();
if(data.contains(PlayerEntity.PERSISTED_NBT_TAG)) {
CompoundNBT cmp = data.getCompound(PlayerEntity.PERSISTED_NBT_TAG);
CompoundNBT cmp1 = cmp.getCompound(TAG_PLAYER_KEPT_DROPS);
@@ -94,7 +94,7 @@ public class ItemKeepIvy extends ItemMod {
}
}
cmp.put(TAG_PLAYER_KEPT_DROPS, new CompoundNBT());
cmp.remove(TAG_PLAYER_KEPT_DROPS);
}
}
@@ -24,7 +24,6 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
@@ -33,6 +32,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.MathHelper;
@@ -78,13 +78,15 @@ public class ItemSextant extends ItemMod {
double radius = calculateRadius(stack, (PlayerEntity) living);
if(count % 10 == 0)
for(int i = 0; i < 360; i++) {
if(count % 10 == 0) {
WispParticleData data = WispParticleData.wisp(0.3F, 0F, 1F, 1F, 1);
for (int i = 0; i < 360; i++) {
float radian = (float) (i * Math.PI / 180);
double xp = x + Math.cos(radian) * radius;
double zp = z + Math.sin(radian) * radius;
Botania.proxy.wispFX(xp + 0.5, source.y + 1, zp + 0.5, 0F, 1F, 1F, 0.3F, -0.01F);
living.world.addParticle(data, xp + 0.5, source.y + 1, zp + 0.5, 0, - -0.01F, 0);
}
}
}
}
@@ -130,9 +132,10 @@ public class ItemSextant extends ItemMod {
int y = ItemNBTHelper.getInt(stack, TAG_SOURCE_Y, -1);
int z = ItemNBTHelper.getInt(stack, TAG_SOURCE_Z, 0);
Vector3 source = new Vector3(x, y, z);
Botania.proxy.wispFX(source.x + 0.5, source.y + 1, source.z + 0.5, 1F, 0F, 0F, 0.2F, -0.1F);
WispParticleData data = WispParticleData.wisp(0.2F, 1F, 0F, 0F, 1);
player.world.addParticle(data, source.x + 0.5, source.y + 1, source.z + 0.5, 0, - -0.1F, 0);
Vector3 centerVec = Vector3.fromEntityCenter(player);
Vector3 centerVec = Vector3.fromEntityCenter(player);
Vector3 diffVec = source.subtract(centerVec);
Vector3 lookVec = new Vector3(player.getLookVec());
double mul = diffVec.y / lookVec.y;
@@ -10,44 +10,30 @@
*/
package vazkii.botania.common.item;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.block.Blocks;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.MobSpawnerTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.MobSpawnerTileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.registries.ForgeRegistries;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.advancements.UseItemSuccessTrigger;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.lib.LibItemNames;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -137,8 +123,10 @@ public class ItemSpawnerMover extends ItemMod {
ctx.getPlayer().sendBreakAnimation(ctx.getHand());
mover.shrink(1);
} else {
for(int i = 0; i < 100; i++)
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);
for(int i = 0; i < 100; i++) {
SparkleParticleData data = SparkleParticleData.sparkle(0.45F + 0.2F * (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 6);
world.addParticle(data, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0, 0, 0);
}
}
}
@@ -168,8 +156,9 @@ public class ItemSpawnerMover extends ItemMod {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.wispFX(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, red, green, blue, (float) Math.random() * 0.1F + 0.05F, (float) (Math.random() - 0.5F) * 0.15F, (float) (Math.random() - 0.5F) * 0.15F, (float) (Math.random() - 0.5F) * 0.15F);
}
WispParticleData data = WispParticleData.wisp((float) Math.random() * 0.1F + 0.05F, red, green, blue);
world.addParticle(data, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, (float) (Math.random() - 0.5F) * 0.15F, (float) (Math.random() - 0.5F) * 0.15F, (float) (Math.random() - 0.5F) * 0.15F);
}
}
return true;
} else return false;
@@ -35,7 +35,6 @@ import net.minecraft.util.Rotation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
@@ -48,6 +47,8 @@ import vazkii.botania.api.wand.ICoordBoundItem;
import vazkii.botania.api.wand.ITileBound;
import vazkii.botania.api.wand.IWandBindable;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockPistonRelay;
import vazkii.botania.common.block.ModBlocks;
@@ -150,8 +151,12 @@ public class ItemTwigWand extends ItemMod implements ICoordBoundItem {
float velMul = 0.07F;
Botania.proxy.wispFX(pos.getX() + 0.5 + x, pos.getY() + 0.5 + y, pos.getZ() + 0.5 + z, red, green, blue, (float) Math.random() * 0.15F + 0.15F, (float) -x * velMul, (float) -y * velMul, (float) -z * velMul);
}
float motionx = (float) -x * velMul;
float motiony = (float) -y * velMul;
float motionz = (float) -z * velMul;
WispParticleData data = WispParticleData.wisp((float) Math.random() * 0.15F + 0.15F, red, green, blue);
world.addParticle(data, pos.getX() + 0.5 + x, pos.getY() + 0.5 + y, pos.getZ() + 0.5 + z, motionx, motiony, motionz);
}
}
return ActionResultType.SUCCESS;
@@ -217,9 +222,8 @@ public class ItemTwigWand extends ItemMod implements ICoordBoundItem {
float g = color.getGreen() / 255F;
float b = color.getBlue() / 255F;
Botania.proxy.setSparkleFXNoClip(true);
Botania.proxy.sparkleFX(currentPos.x, currentPos.y, currentPos.z, r, g, b, 0.5F, 4);
Botania.proxy.setSparkleFXNoClip(false);
SparkleParticleData data = SparkleParticleData.noClip(0.5F, r, g, b, 4);
world.addParticle(data, currentPos.x, currentPos.y, currentPos.z, 0, 0, 0);
currentPos = currentPos.add(movement);
}
}
@@ -10,13 +10,13 @@
*/
package vazkii.botania.common.item;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStackSimple;
import vazkii.botania.common.lib.LibItemNames;
@@ -29,18 +29,18 @@ public class ItemWaterBowl extends ItemMod {
super(builder);
}
/* todo 1.13
@Nonnull
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) {
return new Handler(stack);
}
private static class Handler extends FluidHandlerItemStackSimple.SwapEmpty {
private Handler(ItemStack stack) {
super(stack, new ItemStack(Items.BOWL), Fluid.BUCKET_VOLUME);
setFluid(new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME));
super(stack, new ItemStack(Items.BOWL), FluidAttributes.BUCKET_VOLUME);
setFluid(new FluidStack(Fluids.WATER, FluidAttributes.BUCKET_VOLUME));
}
@Override
@@ -50,9 +50,8 @@ public class ItemWaterBowl extends ItemMod {
@Override
public boolean canDrainFluidType(FluidStack fluid) {
return fluid.getFluid() == FluidRegistry.WATER;
return fluid.getFluid() == Fluids.WATER;
}
}
*/
}
@@ -10,22 +10,17 @@
*/
package vazkii.botania.common.item;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.lib.LibItemNames;
import javax.annotation.Nonnull;
@@ -50,11 +45,10 @@ public class ItemWorldSeed extends ItemMod {
player.setPositionAndUpdate(player.posX, player.posY + 1, player.posZ);
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1F, 1F);
for(int i = 0; i < 50; i++)
Botania.proxy.sparkleFX(player.posX + Math.random() * player.getWidth(),
player.posY - 1.6 + Math.random() * player.getHeight(),
player.posZ + Math.random() * player.getWidth(),
0.25F, 1F, 0.25F, 1F, 10);
SparkleParticleData data = SparkleParticleData.sparkle(1F, 0.25F, 1F, 0.25F, 10);
for(int i = 0; i < 50; i++) {
world.addParticle(data, player.posX + Math.random() * player.getWidth(), player.posY - 1.6 + Math.random() * player.getHeight(), player.posZ + Math.random() * player.getWidth(), 0, 0, 0);
}
stack.shrink(1);
return ActionResult.newResult(ActionResultType.SUCCESS, stack);
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.item.equipment.armor.manasteel;
import com.google.common.collect.Multimap;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.Screen;
@@ -57,6 +56,7 @@ import javax.annotation.Nonnull;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
public class ItemManasteelArmor extends ArmorItem implements IManaUsingItem, IPhantomInkable {
@@ -88,9 +88,9 @@ public class ItemManasteelArmor extends ArmorItem implements IManaUsingItem, IPh
stack.setDamage(stack.getDamage() - 1);
}
// todo 1.13
public void damageArmor(LivingEntity entity, @Nonnull ItemStack stack, DamageSource source, int damage, int slot) {
ToolCommons.damageItem(stack, damage, entity, MANA_PER_DAMAGE);
@Override
public <T extends LivingEntity> int damageItem(ItemStack stack, int amount, T entity, Consumer<T> onBroken) {
return ToolCommons.damageItemIfPossible(stack, amount, entity, MANA_PER_DAMAGE);
}
@Nonnull
@@ -26,6 +26,7 @@ import vazkii.botania.common.lib.LibItemNames;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.function.Consumer;
public class ItemManaweaveHelm extends ItemManaweaveArmor implements IManaDiscountArmor, IManaProficiencyArmor {
@@ -52,8 +53,7 @@ public class ItemManaweaveHelm extends ItemManaweaveArmor implements IManaDiscou
}
@Override
public void damageArmor(LivingEntity entity, @Nonnull ItemStack stack, DamageSource source, int damage, int slot) {
ToolCommons.damageItem(stack, damage, entity, MANA_PER_DAMAGE);
public <T extends LivingEntity> int damageItem(ItemStack stack, int amount, T entity, Consumer<T> onBroken) {
return ToolCommons.damageItemIfPossible(stack, amount, entity, MANA_PER_DAMAGE);
}
}
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.item.equipment.bauble;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
@@ -19,10 +18,9 @@ import net.minecraft.util.SoundCategory;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.lib.LibItemNames;
public class ItemBalanceCloak extends ItemHolyCloak {
@@ -49,8 +47,11 @@ public class ItemBalanceCloak extends ItemHolyCloak {
double y = player.posY + Math.random() * player.getHeight();
double z = player.posZ + Math.random() * player.getWidth() * 2 - player.getWidth();
boolean green = Math.random() > 0.5;
Botania.proxy.sparkleFX(x, y, z, 0.3F, green ? 1F : 0.3F, green ? 0.3F : 1F, 0.8F + (float) Math.random() * 0.4F, 3);
}
float g = green ? 1F : 0.3F;
float b = green ? 0.3F : 1F;
SparkleParticleData data = SparkleParticleData.sparkle(0.8F + (float) Math.random() * 0.4F, 0.3F, g, b, 3);
player.world.addParticle(data, x, y, z, 0, 0, 0);
}
return true;
}
@@ -12,7 +12,6 @@ package vazkii.botania.common.item.equipment.bauble;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.AbstractGui;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.platform.GLX;
import net.minecraft.client.renderer.Tessellator;
@@ -21,8 +20,6 @@ import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
@@ -33,7 +30,6 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -49,6 +45,7 @@ import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ConfigHandler;
@@ -181,10 +178,10 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem {
}
}
for(int i = 0; i < 2; i++)
Botania.proxy.sparkleFX(x + Math.random() * event.getEntityLiving().getWidth(),
y + Math.random() * 0.4, z + Math.random() * event.getEntityLiving().getWidth(),
r, g, b, 2F * (float) Math.random(), 20);
for(int i = 0; i < 2; i++) {
SparkleParticleData data = SparkleParticleData.sparkle(2F * (float) Math.random(), r, g, b, 20);
player.world.addParticle(data, x + Math.random() * event.getEntityLiving().getWidth(), y + Math.random() * 0.4, z + Math.random() * event.getEntityLiving().getWidth(), 0, 0, 0);
}
}
}
} else {
@@ -15,7 +15,6 @@ import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.platform.GLX;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -25,9 +24,9 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import vazkii.botania.api.item.AccessoryRenderHelper;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.client.model.ModelCloak;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.EquipmentHandler;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.ItemNBTHelper;
@@ -109,8 +108,12 @@ public class ItemHolyCloak extends ItemBauble {
double y = player.posY + Math.random() * player.getHeight();
double z = player.posZ + Math.random() * player.getWidth() * 2 - player.getWidth();
boolean yellow = Math.random() > 0.5;
Botania.proxy.sparkleFX(x, y, z, yellow ? 1F : 0.3F, yellow ? 1F : 0.3F, yellow ? 0.3F : 1F, 0.8F + (float) Math.random() * 0.4F, 3);
}
float r = yellow ? 1F : 0.3F;
float g = yellow ? 1F : 0.3F;
float b = yellow ? 0.3F : 1F;
SparkleParticleData data = SparkleParticleData.sparkle(0.8F + (float) Math.random() * 0.4F, r, g, b, 3);
player.world.addParticle(data, x, y, z, 0, 0, 0);
}
return true;
}
@@ -18,23 +18,17 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MerchantOffer;
import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.LongNBT;
import net.minecraft.nbt.LongNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.api.distmarker.Dist;
@@ -48,12 +42,11 @@ import net.minecraftforge.items.wrapper.InvWrapper;
import vazkii.botania.api.item.AccessoryRenderHelper;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.EquipmentHandler;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class ItemItemFinder extends ItemBauble {
@@ -103,24 +96,22 @@ public class ItemItemFinder extends ItemBauble {
return;
ListNBT blocks = ItemNBTHelper.getList(stack, TAG_BLOCK_POSITIONS, Constants.NBT.TAG_LONG, false);
Botania.proxy.setWispFXDepthTest(false);
for(int i = 0; i < blocks.size(); i++) {
BlockPos pos = BlockPos.fromLong(((LongNBT) blocks.get(i)).getLong());
float m = 0.02F;
Botania.proxy.wispFX(pos.getX() + (float) Math.random(), pos.getY() + (float) Math.random(), pos.getZ() + (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.15F + 0.05F * (float) Math.random(), m * (float) (Math.random() - 0.5), m * (float) (Math.random() - 0.5), m * (float) (Math.random() - 0.5));
WispParticleData data = WispParticleData.wisp(0.15F + 0.05F * (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), false);
player.world.addParticle(data, pos.getX() + (float) Math.random(), pos.getY() + (float) Math.random(), pos.getZ() + (float) Math.random() , m * (float) (Math.random() - 0.5), m * (float) (Math.random() - 0.5), m * (float) (Math.random() - 0.5));
}
int[] entities = ItemNBTHelper.getIntArray(stack, TAG_ENTITY_POSITIONS);
for(int i : entities) {
Entity e = player.world.getEntityByID(i);
if(e != null && Math.random() < 0.6) {
Botania.proxy.setWispFXDepthTest(Math.random() < 0.6);
Botania.proxy.wispFX(e.posX + (float) (Math.random() * 0.5 - 0.25) * 0.45F, e.posY + e.getHeight(), e.posZ + (float) (Math.random() * 0.5 - 0.25) * 0.45F, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.15F + 0.05F * (float) Math.random(), -0.05F - 0.03F * (float) Math.random());
WispParticleData data = WispParticleData.wisp(0.15F + 0.05F * (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), Math.random() < 0.6);
player.world.addParticle(data, e.posX + (float) (Math.random() * 0.5 - 0.25) * 0.45F, e.posY + e.getHeight(), e.posZ + (float) (Math.random() * 0.5 - 0.25) * 0.45F, 0, 0.05F + 0.03F * (float) Math.random(), 0);
}
}
Botania.proxy.setWispFXDepthTest(true);
}
protected void tickServer(ItemStack stack, PlayerEntity player) {
@@ -12,8 +12,6 @@ package vazkii.botania.common.item.equipment.bauble;
import net.minecraft.block.Block;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -27,7 +25,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.item.ItemTossEvent;
import vazkii.botania.api.item.IRelic;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.common.block.subtile.functional.SubTileSolegnolia;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.handler.EquipmentHandler;
@@ -66,23 +64,28 @@ public class ItemMagnetRing extends ItemBauble {
}
@Override
public void onWornTick(ItemStack stack, LivingEntity player) {
public void onWornTick(ItemStack stack, LivingEntity living) {
super.onWornTick(stack, living);
if(living.isSpectator())
return;
int cooldown = getCooldown(stack);
if(SubTileSolegnolia.hasSolegnoliaAround(player)) {
if(SubTileSolegnolia.hasSolegnoliaAround(living)) {
if(cooldown < 0)
setCooldown(stack, 2);
return;
}
if(cooldown <= 0) {
if(player.isSneaking() == ConfigHandler.COMMON.invertMagnetRing.get()) {
double x = player.posX;
double y = player.posY + 0.75;
double z = player.posZ;
if(living.isSneaking() == ConfigHandler.COMMON.invertMagnetRing.get()) {
double x = living.posX;
double y = living.posY + 0.75;
double z = living.posZ;
int range = ((ItemMagnetRing) stack.getItem()).range;
List<ItemEntity> items = player.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(x - range, y - range, z - range, x + range, y + range, z + range));
List<ItemEntity> items = living.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(x - range, y - range, z - range, x + range, y + range, z + range));
int pulled = 0;
for(ItemEntity item : items)
if(((ItemMagnetRing) stack.getItem()).canPullItem(item)) {
@@ -90,10 +93,13 @@ public class ItemMagnetRing extends ItemBauble {
break;
MathHelper.setEntityMotionFromVector(item, new Vector3(x, y, z), 0.45F);
if(player.world.isRemote) {
boolean red = player.world.rand.nextBoolean();
Botania.proxy.sparkleFX(item.posX, item.posY, item.posZ, red ? 1F : 0F, 0F, red ? 0F : 1F, 1F, 3);
}
if(living.world.isRemote) {
boolean red = living.world.rand.nextBoolean();
float r = red ? 1F : 0F;
float b = red ? 0F : 1F;
SparkleParticleData data = SparkleParticleData.sparkle(1F, r, 0F, b, 3);
living.world.addParticle(data, item.posX, item.posY, item.posZ, 0, 0, 0);
}
pulled++;
}
}
@@ -101,7 +107,7 @@ public class ItemMagnetRing extends ItemBauble {
}
private boolean canPullItem(ItemEntity item) {
if(!item.isAlive() || item.pickupDelay >= 40 || SubTileSolegnolia.hasSolegnoliaAround(item))
if(!item.isAlive() || item.pickupDelay >= 40 || SubTileSolegnolia.hasSolegnoliaAround(item) || item.getPersistentData().getBoolean("PreventRemoteMovement"))
return false;
ItemStack stack = item.getItem();
@@ -87,14 +87,14 @@ public class ItemTinyPlanet extends ItemBauble {
}
public static int getEntityOrbitTime(Entity entity) {
CompoundNBT cmp = entity.getEntityData();
CompoundNBT cmp = entity.getPersistentData();
if(cmp.contains(TAG_ORBIT))
return cmp.getInt(TAG_ORBIT);
else return 0;
}
public static void incrementOrbitTime(Entity entity) {
CompoundNBT cmp = entity.getEntityData();
CompoundNBT cmp = entity.getPersistentData();
int time = getEntityOrbitTime(entity);
cmp.putInt(TAG_ORBIT, time + 1);
}
@@ -15,7 +15,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
@@ -24,10 +23,9 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.lib.LibItemNames;
import java.util.List;
@@ -56,8 +54,9 @@ public class ItemUnholyCloak extends ItemHolyCloak {
float rad = i * 4F * (float) Math.PI / 180F;
float xMotion = (float) Math.cos(rad) * 0.2F;
float zMotion = (float) Math.sin(rad) * 0.2F;
Botania.proxy.wispFX(player.posX, player.posY + 0.5, player.posZ, 0.4F + (float) Math.random() + 0.25F, 0F, 0F, 0.6F + (float) Math.random() * 0.2F, xMotion, 0F, zMotion);
}
WispParticleData data = WispParticleData.wisp(0.6F + (float) Math.random() * 0.2F, 0.4F + (float) Math.random() + 0.25F, 0F, 0F);
player.world.addParticle(data, player.posX, player.posY + 0.5, player.posZ, xMotion, 0F, zMotion);
}
return true;
}
@@ -50,6 +50,25 @@ public final class ToolCommons {
public static final List<Material> materialsShovel = Arrays.asList(Material.ORGANIC, Material.EARTH, Material.SAND, Material.SNOW, Material.SNOW_BLOCK, Material.CLAY);
public static final List<Material> materialsAxe = Arrays.asList(Material.CORAL, Material.LEAVES, Material.PLANTS, Material.WOOD, Material.GOURD);
/**
* Consumes as much mana as possible, returning the amount of damage that couldn't be paid with mana
*/
public static int damageItemIfPossible(ItemStack stack, int amount, LivingEntity entity, int manaPerDamage) {
if(!(entity instanceof PlayerEntity))
return amount;
PlayerEntity player = (PlayerEntity) entity;
while (amount > 0) {
if (ManaItemHandler.requestManaExactForTool(stack, player, manaPerDamage, true)) {
amount--;
} else {
break;
}
}
return amount;
}
public static void damageItem(ItemStack stack, int dmg, LivingEntity entity, int manaPerDamage) {
int manaToRequest = dmg * manaPerDamage;
boolean manaRequested = entity instanceof PlayerEntity && ManaItemHandler.requestManaExactForTool(stack, (PlayerEntity) entity, manaToRequest, true);
@@ -10,13 +10,12 @@
*/
package vazkii.botania.common.item.lens;
import net.minecraft.item.DyeColor;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.MathHelper;
import vazkii.botania.api.mana.IManaSpreader;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import java.awt.Color;
@@ -62,7 +61,8 @@ public class LensFlare extends Lens {
float g = ((hex & 0xFF00) >> 8) / 255F;
float b = (hex & 0xFF) / 255F;
Botania.proxy.wispFX(tile.getPos().getX() + 0.5, tile.getPos().getY() + 0.5, tile.getPos().getZ() + 0.5, r, g, b, 0.4F, mx, my, mz);
}
WispParticleData data = WispParticleData.wisp(0.4F, r, g, b);
tile.getWorld().addParticle(data, tile.getPos().getX() + 0.5, tile.getPos().getY() + 0.5, tile.getPos().getZ() + 0.5, mx, my, mz);
}
}
@@ -20,15 +20,15 @@ import vazkii.botania.common.core.helper.Vector3;
public class LensMagnet extends Lens {
private static final String TAG_MAGNETIZED = "Botania:Magnetized";
private static final String TAG_MAGNETIZED_X = "Botania:MagnetizedX";
private static final String TAG_MAGNETIZED_Y = "Botania:MagnetizedY";
private static final String TAG_MAGNETIZED_Z = "Botania:MagnetizedZ";
private static final String TAG_MAGNETIZED = "botania:magnetized";
private static final String TAG_MAGNETIZED_X = "botania:magnetized_x";
private static final String TAG_MAGNETIZED_Y = "botania:magnetized_y";
private static final String TAG_MAGNETIZED_Z = "botania:magnetized_z";
@Override
public void updateBurst(IManaBurst burst, ThrowableEntity entity, ItemStack stack) {
BlockPos basePos = new BlockPos(entity);
boolean magnetized = entity.getEntityData().contains(TAG_MAGNETIZED);
boolean magnetized = entity.getPersistentData().contains(TAG_MAGNETIZED);
int range = 3;
magnetize : {
@@ -38,9 +38,9 @@ public class LensMagnet extends Lens {
TileEntity tile = entity.world.getTileEntity(pos);
if(magnetized) {
int magX = entity.getEntityData().getInt(TAG_MAGNETIZED_X);
int magY = entity.getEntityData().getInt(TAG_MAGNETIZED_Y);
int magZ = entity.getEntityData().getInt(TAG_MAGNETIZED_Z);
int magX = entity.getPersistentData().getInt(TAG_MAGNETIZED_X);
int magY = entity.getPersistentData().getInt(TAG_MAGNETIZED_Y);
int magZ = entity.getPersistentData().getInt(TAG_MAGNETIZED_Z);
if(tile.getPos().getX() != magX || tile.getPos().getY() != magY || tile.getPos().getZ() != magZ)
continue;
}
@@ -61,10 +61,10 @@ public class LensMagnet extends Lens {
Vector3 finalMotionVec = motionVec.subtract(differenceVec);
if(!magnetized) {
finalMotionVec = finalMotionVec.multiply(0.75);
entity.getEntityData().putBoolean(TAG_MAGNETIZED, true);
entity.getEntityData().putInt(TAG_MAGNETIZED_X, tile.getPos().getX());
entity.getEntityData().putInt(TAG_MAGNETIZED_Y, tile.getPos().getY());
entity.getEntityData().putInt(TAG_MAGNETIZED_Z, tile.getPos().getZ());
entity.getPersistentData().putBoolean(TAG_MAGNETIZED, true);
entity.getPersistentData().putInt(TAG_MAGNETIZED_X, tile.getPos().getX());
entity.getPersistentData().putInt(TAG_MAGNETIZED_Y, tile.getPos().getY());
entity.getPersistentData().putInt(TAG_MAGNETIZED_Z, tile.getPos().getZ());
}
burst.setBurstMotion(finalMotionVec.x, finalMotionVec.y, finalMotionVec.z);
@@ -28,7 +28,7 @@ public class LensTripwire extends Lens {
public boolean allowBurstShooting(ItemStack stack, IManaSpreader spreader, boolean redstone) {
IManaBurst burst = spreader.runBurstSimulation();
Entity e = (Entity) burst;
return e.getEntityData().getBoolean(TAG_TRIPPED);
return e.getPersistentData().getBoolean(TAG_TRIPPED);
}
@Override
@@ -41,7 +41,7 @@ public class LensTripwire extends Lens {
List<LivingEntity> entities = entity.world.getEntitiesWithinAABB(LivingEntity.class, axis);
if(!entities.isEmpty()) {
Entity e = (Entity) burst;
e.getEntityData().putBoolean(TAG_TRIPPED, true);
e.getPersistentData().putBoolean(TAG_TRIPPED, true);
}
}
@@ -39,7 +39,7 @@ public class LensWarp extends Lens {
entity.setPosition(key.blockPos.getX() + 0.5, key.blockPos.getY() + 0.5, key.blockPos.getZ() + 0.5);
burst.setCollidedAt(key.blockPos);
entity.getEntityData().putBoolean(TAG_WARPED, true);
entity.getPersistentData().putBoolean(TAG_WARPED, true);
return false;
}
@@ -50,7 +50,7 @@ public class LensWarp extends Lens {
@Override
public int getManaToTransfer(IManaBurst burst, ThrowableEntity entity, ItemStack stack, IManaReceiver receiver) {
return entity.getEntityData().getBoolean(TAG_WARPED) ? 0 : burst.getMana();
return entity.getPersistentData().getBoolean(TAG_WARPED) ? 0 : burst.getMana();
}
}
@@ -12,34 +12,26 @@ package vazkii.botania.common.item.relic;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.UseAction;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.SoundEvents;
import net.minecraft.item.UseAction;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.api.wand.ICoordBoundItem;
import vazkii.botania.common.Botania;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.network.PacketBotaniaEffect;
import vazkii.botania.common.network.PacketHandler;
@@ -70,8 +62,9 @@ public class ItemFlugelEye extends ItemRelic implements ICoordBoundItem, IManaUs
float x1 = (float) (pos.getX() + Math.random());
float y1 = pos.getY() + 1;
float z1 = (float) (pos.getZ() + Math.random());
Botania.proxy.wispFX(x1, y1, z1, (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random() * 0.5F, -0.05F + (float) Math.random() * 0.05F);
}
WispParticleData data = WispParticleData.wisp((float) Math.random() * 0.5F, (float) Math.random(), (float) Math.random(), (float) Math.random(), 1);
world.addParticle(data, x1, y1, z1, 0, -(-0.05F + (float) Math.random() * 0.05F), 0);
}
} else {
ItemStack stack = ctx.getItem();
ItemNBTHelper.setInt(stack, TAG_X, pos.getX());
@@ -92,8 +85,9 @@ public class ItemFlugelEye extends ItemRelic implements ICoordBoundItem, IManaUs
float x = (float) (living.posX - Math.random() * living.getWidth());
float y = (float) (living.posY + Math.random());
float z = (float) (living.posZ - Math.random() * living.getWidth());
Botania.proxy.wispFX(x, y, z, (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random() * 0.7F, -0.05F - (float) Math.random() * 0.05F);
}
WispParticleData data = WispParticleData.wisp((float) Math.random() * 0.7F, (float) Math.random(), (float) Math.random(), (float) Math.random(), 1);
living.world.addParticle(data, x, y, z, 0, 0.05F + (float) Math.random() * 0.05F, 0);
}
@Nonnull
@Override
@@ -12,8 +12,6 @@ package vazkii.botania.common.item.rod;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockState;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.block.Blocks;
@@ -21,24 +19,20 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
import vazkii.botania.api.item.IAvatarTile;
import vazkii.botania.api.item.IAvatarWieldable;
import vazkii.botania.api.item.IBlockProvider;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.client.fx.SparkleParticleData;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.item.ItemMod;
import vazkii.botania.common.lib.LibItemNames;
import javax.annotation.Nonnull;
@@ -75,10 +69,10 @@ public class ItemDirtRod extends ItemMod implements IManaUsingItem, IBlockProvid
if(stackToPlace.isEmpty()) {
ManaItemHandler.requestManaExactForTool(stack, player, cost, true);
for(int i = 0; i < 6; i++)
Botania.proxy.sparkleFX(pos.getX() + side.getXOffset() + Math.random(),
pos.getY() + side.getYOffset() + Math.random(),
pos.getZ() + side.getZOffset() + Math.random(), r, g, b, 1F, 5);
SparkleParticleData data = SparkleParticleData.sparkle(1F, r, g, b, 5);
for(int i = 0; i < 6; i++) {
world.addParticle(data, pos.getX() + side.getXOffset() + Math.random(), pos.getY() + side.getYOffset() + Math.random(), pos.getZ() + side.getZOffset() + Math.random(), 0, 0, 0);
}
return ActionResultType.SUCCESS;
}
}
@@ -12,14 +12,11 @@ package vazkii.botania.common.item.rod;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
@@ -30,11 +27,10 @@ import vazkii.botania.api.item.IAvatarWieldable;
import vazkii.botania.api.item.IManaProficiencyArmor;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.item.ItemMod;
import vazkii.botania.common.lib.LibItemNames;
import javax.annotation.Nonnull;
import java.util.Random;
@@ -67,21 +63,19 @@ public class ItemDiviningRod extends ItemMod implements IManaUsingItem, IAvatarW
}
private void doHighlight(World world, BlockPos pos, int range, long seedxor) {
Botania.proxy.setWispFXDepthTest(false);
for(BlockPos pos_ : BlockPos.getAllInBoxMutable(pos.add(-range, -range, -range),
pos.add(range, range, range))) {
BlockState state = world.getBlockState(pos_);
if(Tags.Blocks.ORES.contains(state.getBlock())) {
Random rand = new Random(state.hashCode() ^ seedxor);
Botania.proxy.wispFX(pos_.getX() + world.rand.nextFloat(),
WispParticleData data = WispParticleData.wisp(0.25F, rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 8);
world.addParticle(data, pos_.getX() + world.rand.nextFloat(),
pos_.getY() + world.rand.nextFloat(),
pos_.getZ() + world.rand.nextFloat(),
rand.nextFloat(), rand.nextFloat(), rand.nextFloat(),
0.25F, 0F, 8);
0, 0, 0);
}
}
Botania.proxy.setWispFXDepthTest(true);
}
@Override
Loaded 100 of 130 files, more files were not shown because too many files have changed in this diff. Show more