mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-26 13:18:34 +01:00
some more misc fixes
This commit is contained in:
parent
8d064816ef
commit
8fb7beb49f
40 changed files with 714 additions and 674 deletions
|
@ -88,7 +88,7 @@ public final class Helper {
|
|||
List<ItemFrameEntity> frames = world.getEntitiesWithinAABB(ItemFrameEntity.class, new AxisAlignedBB(pos).grow(0.25));
|
||||
for (int i = frames.size() - 1; i >= 0; i--) {
|
||||
ItemFrameEntity frame = frames.get(i);
|
||||
BlockPos framePos = frame.getHangingPosition().offset(frame.getHorizontalFacing());
|
||||
BlockPos framePos = frame.getHangingPosition().offset(frame.getHorizontalFacing().getOpposite());
|
||||
if (!pos.equals(framePos))
|
||||
frames.remove(i);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public final class ModConfig {
|
|||
//@Comment("If debug information about Aura around the player should be displayed in the F3 debug menu if the player is in creative mode")
|
||||
public boolean debugText = true;
|
||||
//@Comment("If, when the F3 debug menu is open and the player is in creative mode, every Aura spot should be highlighted in the world for debug purposes")
|
||||
public boolean debugWorld = false;
|
||||
public boolean debugWorld = true;
|
||||
}
|
||||
|
||||
public static void initOrReload(boolean reload) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.api.multiblock;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
|
||||
|
@ -28,31 +29,8 @@ public class Matcher {
|
|||
return new Matcher(Blocks.AIR.getDefaultState(), null);
|
||||
}
|
||||
|
||||
public static Matcher oreDict(Block defaultBlock, String name) {
|
||||
return new Matcher(defaultBlock.getDefaultState(),
|
||||
(world, start, offset, pos, state, otherC) -> state.getBlock() == defaultBlock);
|
||||
/* TODO return new Matcher(defaultBlock.getDefaultState(), new ICheck() {
|
||||
private List<BlockState> states;
|
||||
|
||||
@Override
|
||||
public boolean matches(World world, BlockPos start, BlockPos offset, BlockPos pos, BlockState state, char c) {
|
||||
if (this.states == null) {
|
||||
this.states = new ArrayList<>();
|
||||
for (ItemStack stack : OreDictionary.getOres(name)) {
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
if (block != null && block != Blocks.AIR) {
|
||||
int damage = stack.getItemDamage();
|
||||
if (damage == OreDictionary.WILDCARD_VALUE)
|
||||
this.states.addAll(block.getBlockState().getValidStates());
|
||||
else
|
||||
this.states.add(block.getStateFromMeta(damage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this.states.isEmpty() || this.states.contains(state);
|
||||
}
|
||||
});*/
|
||||
public static Matcher tag(Block defaultBlock, Tag tag) {
|
||||
return new Matcher(defaultBlock.getDefaultState(), (world, start, offset, pos, state, c) -> state.getBlock().getTags().contains(tag.getId()));
|
||||
}
|
||||
|
||||
public interface ICheck {
|
||||
|
|
|
@ -2,6 +2,9 @@ package de.ellpeck.naturesaura.blocks;
|
|||
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import de.ellpeck.naturesaura.packet.PacketClient;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import de.ellpeck.naturesaura.reg.IModItem;
|
||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
|
@ -60,7 +63,7 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I
|
|||
if (stack.getItem() == ModItems.RANGE_VISUALIZER) {
|
||||
if (!worldIn.isRemote) {
|
||||
BlockPos goalPos = this.getGoalCoords(worldIn, pos);
|
||||
// TODO PacketHandler.sendTo(player, new PacketClient(0, this.goalDim, goalPos.getX(), goalPos.getY(), goalPos.getZ()));
|
||||
PacketHandler.sendTo(player, new PacketClient(0, this.goalDim, goalPos.getX(), goalPos.getY(), goalPos.getZ()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -77,7 +80,7 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I
|
|||
return;
|
||||
|
||||
AxisAlignedBB box = cart.getCollisionBoundingBox();
|
||||
// TODO PacketHandler.sendToAllAround(world, pos, 32, new PacketParticles((float) box.minX, (float) box.minY, (float) box.minZ, 25, (int) ((box.maxX - box.minX) * 100F), (int) ((box.maxY - box.minY) * 100F), (int) ((box.maxZ - box.minZ) * 100F)));
|
||||
PacketHandler.sendToAllAround(world, pos, 32, new PacketParticles((float) box.minX, (float) box.minY, (float) box.minZ, 25, (int) ((box.maxX - box.minX) * 100F), (int) ((box.maxY - box.minY) * 100F), (int) ((box.maxZ - box.minZ) * 100F)));
|
||||
world.playSound(null, pos, SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.BLOCKS, 1F, 1F);
|
||||
|
||||
BlockPos goalCoords = this.getGoalCoords(world, pos);
|
||||
|
@ -118,7 +121,6 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I
|
|||
return SHAPE;
|
||||
}
|
||||
|
||||
|
||||
public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -98,10 +98,9 @@ public class BlockGoldenLeaves extends LeavesBlock implements
|
|||
}
|
||||
*/
|
||||
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
|
||||
super.tick(state, worldIn, pos, random);
|
||||
public void randomTick(BlockState state, World worldIn, BlockPos pos, Random random) {
|
||||
super.randomTick(state, worldIn, pos, random);
|
||||
if (!worldIn.isRemote) {
|
||||
int stage = state.get(STAGE);
|
||||
if (stage < HIGHEST_STAGE) {
|
||||
|
@ -118,8 +117,7 @@ public class BlockGoldenLeaves extends LeavesBlock implements
|
|||
|
||||
public static boolean convert(World world, BlockPos pos) {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock().isFoliage(state, world, pos) &&
|
||||
!(state.getBlock() instanceof BlockAncientLeaves || state.getBlock() instanceof BlockGoldenLeaves)) {
|
||||
if ((state.getBlock().isFoliage(state, world, pos) || state.getBlock() instanceof LeavesBlock) && !(state.getBlock() instanceof BlockAncientLeaves || state.getBlock() instanceof BlockGoldenLeaves)) {
|
||||
if (!world.isRemote) {
|
||||
world.setBlockState(pos, ModBlocks.GOLDEN_LEAVES.getDefaultState()
|
||||
.with(DISTANCE, state.has(DISTANCE) ? state.get(DISTANCE) : 1)
|
||||
|
|
|
@ -3,6 +3,8 @@ package de.ellpeck.naturesaura.blocks;
|
|||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.api.render.IVisualizable;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityPickupStopper;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
|
@ -43,9 +45,9 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
|
|||
|
||||
event.setCanceled(true);
|
||||
|
||||
/* if (item.world.getGameTime() % 3 == 0) TODO particles
|
||||
if (item.world.getGameTime() % 3 == 0)
|
||||
PacketHandler.sendToAllAround(item.world, pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 14));*/
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 14));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,8 +2,9 @@ package de.ellpeck.naturesaura.blocks;
|
|||
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -13,6 +14,7 @@ import net.minecraft.util.SoundCategory;
|
|||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
@ -30,15 +32,18 @@ public class BlockProjectileGenerator extends BlockContainerImpl/* implements IT
|
|||
Entity entity = event.getEntity();
|
||||
if (entity.world.isRemote)
|
||||
return;
|
||||
BlockRayTraceResult ray = (BlockRayTraceResult) event.getRayTraceResult();
|
||||
BlockPos pos = ray.getPos();
|
||||
RayTraceResult ray = event.getRayTraceResult();
|
||||
if (!(ray instanceof BlockRayTraceResult))
|
||||
return;
|
||||
BlockRayTraceResult blockRay = (BlockRayTraceResult) ray;
|
||||
BlockPos pos = blockRay.getPos();
|
||||
if (pos == null)
|
||||
return;
|
||||
TileEntity tile = entity.world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityProjectileGenerator))
|
||||
return;
|
||||
TileEntityProjectileGenerator generator = (TileEntityProjectileGenerator) tile;
|
||||
if (generator.nextSide != ray.getFace())
|
||||
if (generator.nextSide != blockRay.getFace())
|
||||
return;
|
||||
ResourceLocation name = ForgeRegistries.ENTITIES.getKey(entity.getType());
|
||||
Integer amount = NaturesAuraAPI.PROJECTILE_GENERATIONS.get(name);
|
||||
|
@ -48,9 +53,8 @@ public class BlockProjectileGenerator extends BlockContainerImpl/* implements IT
|
|||
BlockPos spot = IAuraChunk.getLowestSpot(entity.world, pos, 35, pos);
|
||||
IAuraChunk.getAuraChunk(entity.world, spot).storeAura(spot, amount);
|
||||
|
||||
// TODO particles
|
||||
/* PacketHandler.sendToAllAround(entity.world, pos, 32,
|
||||
new PacketParticles((float) entity.posX, (float) entity.posY, (float) entity.posZ, 26, pos.getX(), pos.getY(), pos.getZ()));*/
|
||||
PacketHandler.sendToAllAround(entity.world, pos, 32,
|
||||
new PacketParticles((float) entity.posX, (float) entity.posY, (float) entity.posZ, 26, pos.getX(), pos.getY(), pos.getZ()));
|
||||
entity.world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_ENDER_EYE_LAUNCH, SoundCategory.BLOCKS, 0.8F, 1F);
|
||||
|
||||
generator.nextSide = generator.nextSide.rotateY();
|
||||
|
|
|
@ -5,6 +5,8 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|||
import de.ellpeck.naturesaura.api.render.IVisualizable;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntitySpawnLamp;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.MobEntity;
|
||||
|
@ -55,9 +57,8 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable
|
|||
BlockPos spot = IAuraChunk.getHighestSpot(world, lampPos, 32, lampPos);
|
||||
IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 200);
|
||||
|
||||
// TODO particles
|
||||
/*PacketHandler.sendToAllAround(world, lampPos, 32,
|
||||
new PacketParticles(lampPos.getX(), lampPos.getY(), lampPos.getZ(), 15));*/
|
||||
PacketHandler.sendToAllAround(world, lampPos, 32,
|
||||
new PacketParticles(lampPos.getX(), lampPos.getY(), lampPos.getZ(), 15));
|
||||
}
|
||||
|
||||
event.setResult(Event.Result.DENY);
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.block.Blocks;
|
|||
import net.minecraft.block.LogBlock;
|
||||
import net.minecraft.block.SaplingBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public final class Multiblocks {
|
||||
|
@ -23,7 +24,7 @@ public final class Multiblocks {
|
|||
{" ", " WBW ", " WBW ", " WWCWCWW ", " BBW WBB ", " WWCWCWW ", " WBW ", " WBW ", " "}},
|
||||
'C', Blocks.CHISELED_STONE_BRICKS,
|
||||
'B', Blocks.STONE_BRICKS,
|
||||
'W', Blocks.OAK_PLANKS, // TODO create a matcher that matches by tag for planks
|
||||
'W', Matcher.tag(Blocks.OAK_PLANKS, BlockTags.PLANKS),
|
||||
'M', ModBlocks.GOLD_BRICK,
|
||||
'0', ModBlocks.NATURE_ALTAR,
|
||||
' ', Matcher.wildcard());
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles;
|
||||
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
@ -28,8 +30,8 @@ public class TileEntityAnimalGenerator extends TileEntityImpl implements ITickab
|
|||
remain -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, remain);
|
||||
}
|
||||
|
||||
/*PacketHandler.sendToAllAround(this.world, this.pos, 32, TODO particles
|
||||
new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 16));*/
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 16));
|
||||
}
|
||||
|
||||
this.timeRemaining -= 10;
|
||||
|
|
|
@ -6,6 +6,8 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
|
||||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -87,9 +89,8 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
|
|||
|
||||
for (ItemEntity item : items) {
|
||||
item.remove();
|
||||
// TODO particles
|
||||
/*PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 19));*/
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 19));
|
||||
}
|
||||
|
||||
this.currentRecipe = recipe;
|
||||
|
|
|
@ -2,6 +2,8 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
|
||||
import de.ellpeck.naturesaura.blocks.BlockAutoCrafter;
|
||||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -107,9 +109,8 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickableTi
|
|||
this.world.addEntity(remItem);
|
||||
}
|
||||
|
||||
// TODO particles
|
||||
/* PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 19));*/
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 19));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.container.BasicAuraContainer;
|
||||
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -70,9 +72,8 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickableTile
|
|||
this.isDrainMode = true;
|
||||
item.remove();
|
||||
|
||||
// TODO particles
|
||||
/* PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 21, this.container.getAuraColor()));*/
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 21, this.container.getAuraColor()));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -3,6 +3,9 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.ModConfig;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.ItemFrameEntity;
|
||||
|
@ -154,8 +157,7 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickableT
|
|||
private void sendParticles() {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
BlockPos p = j == 0 ? this.pos : this.getConnectedPos();
|
||||
// TODO particles
|
||||
/* PacketHandler.sendToAllAround(this.world, p, 32, new PacketParticleStream(
|
||||
PacketHandler.sendToAllAround(this.world, p, 32, new PacketParticleStream(
|
||||
p.getX() + (float) this.world.rand.nextGaussian() * 3F,
|
||||
p.getY() + 1 + this.world.rand.nextFloat() * 3F,
|
||||
p.getZ() + (float) this.world.rand.nextGaussian() * 3F,
|
||||
|
@ -163,7 +165,7 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickableT
|
|||
p.getY() + 0.5F,
|
||||
p.getZ() + 0.5F,
|
||||
this.world.rand.nextFloat() * 0.07F + 0.07F, IAuraType.forWorld(this.world).getColor(), this.world.rand.nextFloat() + 0.5F
|
||||
));*/
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.entity.item.FireworkRocketEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -105,10 +108,9 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick
|
|||
data.add(this.pos.getY());
|
||||
data.add(this.pos.getZ());
|
||||
data.addAll(usedColors);
|
||||
// TODO particles
|
||||
/* PacketHandler.sendToAllLoaded(this.world, this.pos, new PacketParticles(
|
||||
PacketHandler.sendToAllLoaded(this.world, this.pos, new PacketParticles(
|
||||
(float) this.trackedEntity.posX, (float) this.trackedEntity.posY, (float) this.trackedEntity.posZ,
|
||||
24, Ints.toArray(data)));*/
|
||||
24, Ints.toArray(data)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,15 @@ import de.ellpeck.naturesaura.Helper;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
@ -77,10 +79,9 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
|||
|
||||
this.world.removeBlock(pos, false);
|
||||
|
||||
// TODO particles
|
||||
int color = Helper.blendColors(0x5ccc30, 0xe53c16, toAdd / (float) addAmount);
|
||||
if (toAdd > 0) {
|
||||
/*for (int i = this.world.rand.nextInt(5) + 5; i >= 0; i--)
|
||||
for (int i = this.world.rand.nextInt(5) + 5; i >= 0; i--)
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticleStream(
|
||||
pos.getX() + 0.25F + this.world.rand.nextFloat() * 0.5F,
|
||||
pos.getY() + 0.25F + this.world.rand.nextFloat() * 0.5F,
|
||||
|
@ -90,9 +91,9 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
|||
this.pos.getZ() + 0.25F + this.world.rand.nextFloat() * 0.5F,
|
||||
this.world.rand.nextFloat() * 0.02F + 0.1F, color, 1F
|
||||
));
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 8));*/
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 8));
|
||||
}
|
||||
//PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(pos.getX(), pos.getY(), pos.getZ(), 7, color));
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(pos.getX(), pos.getY(), pos.getZ(), 7, color));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles;
|
||||
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.blocks.BlockFurnaceHeater;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.FurnaceTileEntity;
|
||||
|
@ -44,8 +47,7 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
|
|||
did = true;
|
||||
|
||||
if (this.world.getGameTime() % 15 == 0) {
|
||||
// TODO particles
|
||||
/*PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticleStream(
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticleStream(
|
||||
this.pos.getX() + (float) this.world.rand.nextGaussian() * 5F,
|
||||
this.pos.getY() + 1 + this.world.rand.nextFloat() * 5F,
|
||||
this.pos.getZ() + (float) this.world.rand.nextGaussian() * 5F,
|
||||
|
@ -53,7 +55,7 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
|
|||
tilePos.getY() + this.world.rand.nextFloat(),
|
||||
tilePos.getZ() + this.world.rand.nextFloat(),
|
||||
this.world.rand.nextFloat() * 0.07F + 0.07F, IAuraType.forWorld(this.world).getColor(), this.world.rand.nextFloat() + 0.5F
|
||||
));*/
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles;
|
||||
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.HopperBlock;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -60,9 +62,8 @@ public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickable
|
|||
BlockPos spot = IAuraChunk.getHighestSpot(this.world, this.pos, 25, this.pos);
|
||||
IAuraChunk.getAuraChunk(this.world, spot).drainAura(spot, 500);
|
||||
|
||||
// TODO particles
|
||||
/* PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 10));*/
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
|||
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
|
@ -13,8 +14,8 @@ import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
|
@ -22,6 +23,7 @@ import net.minecraftforge.items.IItemHandler;
|
|||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class TileEntityImpl extends TileEntity {
|
||||
|
||||
|
@ -31,12 +33,6 @@ public class TileEntityImpl extends TileEntity {
|
|||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
// TODO figure out if this was still needed
|
||||
/* @Override
|
||||
public boolean shouldRefresh(World world, BlockPos pos, BlockState oldState, BlockState newState) {
|
||||
return oldState.getBlock() != newState.getBlock();
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public CompoundNBT write(CompoundNBT compound) {
|
||||
this.writeNBT(compound, SaveType.TILE);
|
||||
|
@ -92,11 +88,10 @@ public class TileEntityImpl extends TileEntity {
|
|||
}
|
||||
|
||||
public void sendToClients() {
|
||||
// TODO send this shit to the client somehow
|
||||
/* ServerWorld world = (ServerWorld) this.getWorld();
|
||||
Stream<ServerPlayerEntity> entities = world.getChunkProvider().chunkManager.getTrackingPlayers(new ChunkPos(this.getPos().getX() >> 4, this.getPos().getZ() >> 4), false);
|
||||
ServerWorld world = (ServerWorld) this.getWorld();
|
||||
Stream<ServerPlayerEntity> entities = world.getChunkProvider().chunkManager.getTrackingPlayers(new ChunkPos(this.getPos()), false);
|
||||
SUpdateTileEntityPacket packet = this.getUpdatePacket();
|
||||
entities.forEach(()-> packet.packet);*/
|
||||
entities.forEach(e -> e.connection.sendPacket(packet));
|
||||
}
|
||||
|
||||
public IItemHandlerModifiable getItemHandler(Direction facing) {
|
||||
|
|
|
@ -2,6 +2,8 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
|
@ -46,9 +48,8 @@ public class TileEntityMossGenerator extends TileEntityImpl implements ITickable
|
|||
toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd);
|
||||
}
|
||||
|
||||
// TODO particles
|
||||
/*PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 23));*/
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 23));
|
||||
}
|
||||
|
||||
this.world.playEvent(2001, offset, Block.getStateId(state));
|
||||
|
|
|
@ -7,6 +7,9 @@ import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
|||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.api.recipes.AltarRecipe;
|
||||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
@ -100,15 +103,14 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTi
|
|||
chunk.drainAura(spot, toStore);
|
||||
this.container.storeAura(toStore, false);
|
||||
|
||||
// TODO particles
|
||||
/*if (this.world.getGameTime() % 3 == 0)
|
||||
if (this.world.getGameTime() % 3 == 0)
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticleStream(
|
||||
this.pos.getX() + (float) rand.nextGaussian() * 10F,
|
||||
this.pos.getY() + rand.nextFloat() * 10F,
|
||||
this.pos.getZ() + (float) rand.nextGaussian() * 10F,
|
||||
this.pos.getX() + 0.5F, this.pos.getY() + 0.5F, this.pos.getZ() + 0.5F,
|
||||
rand.nextFloat() * 0.1F + 0.1F, 0x89cc37, rand.nextFloat() * 1F + 1F
|
||||
));*/
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,10 +123,8 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTi
|
|||
if (stored > 0) {
|
||||
this.container.drainAura(stored, false);
|
||||
|
||||
// TODO particles
|
||||
/*if (this.world.getGameTime() % 4 == 0)
|
||||
if (this.world.getGameTime() % 4 == 0)
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 4));
|
||||
*/
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -141,10 +141,8 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickableTi
|
|||
if (this.container.getStoredAura() >= req) {
|
||||
this.container.drainAura(req, false);
|
||||
|
||||
// TODO particles
|
||||
/*if (this.timer % 4 == 0)
|
||||
if (this.timer % 4 == 0)
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 4));
|
||||
*/
|
||||
|
||||
this.timer++;
|
||||
if (this.timer >= this.currentRecipe.time) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles;
|
||||
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.LogBlock;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
|
@ -31,10 +33,9 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickableT
|
|||
toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd);
|
||||
}
|
||||
|
||||
// TODO particles
|
||||
/* PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||
this.pos.getX(), this.pos.getY(), this.pos.getZ(), 12,
|
||||
pos.getX(), pos.getY(), pos.getZ(), canGen ? 1 : 0));*/
|
||||
pos.getX(), pos.getY(), pos.getZ(), canGen ? 1 : 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import de.ellpeck.naturesaura.Helper;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.recipes.OfferingRecipe;
|
||||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
@ -74,10 +76,9 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
|
|||
|
||||
// TODO weather effects
|
||||
//this.world.addWeatherEffect(new LightningBoltEntity(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true));
|
||||
// TODO particles
|
||||
/* PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||
(float) item.posX, (float) item.posY, (float) item.posZ, 13,
|
||||
this.pos.getX(), this.pos.getY(), this.pos.getZ()));*/
|
||||
this.pos.getX(), this.pos.getY(), this.pos.getZ()));
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.item.ItemFrameEntity;
|
||||
|
@ -74,8 +76,7 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickableTileEnt
|
|||
BlockPos spot = IAuraChunk.getHighestSpot(this.world, this.pos, 10, this.pos);
|
||||
IAuraChunk.getAuraChunk(this.world, spot).drainAura(spot, 1000);
|
||||
|
||||
// TODO particles
|
||||
// PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(pos.getX(), pos.getY(), pos.getZ(), 9));
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(pos.getX(), pos.getY(), pos.getZ(), 9));
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,10 +2,13 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.entity.AreaEffectCloudEntity;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionUtils;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -49,10 +52,9 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab
|
|||
toAdd -= IAuraChunk.getAuraChunk(this.world, spot).storeAura(spot, toAdd);
|
||||
}
|
||||
|
||||
// TODO particles
|
||||
/* PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||
this.pos.getX(), this.pos.getY(), this.pos.getZ(), 5,
|
||||
PotionUtils.getPotionColor(type), canGen ? 1 : 0));*/
|
||||
PotionUtils.getPotionColor(type), canGen ? 1 : 0));
|
||||
|
||||
addedOne = true;
|
||||
break;
|
||||
|
|
|
@ -3,6 +3,8 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
import de.ellpeck.naturesaura.ModConfig;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -82,9 +84,8 @@ public class TileEntityRFConverter extends TileEntityImpl implements ITickableTi
|
|||
BlockPos pos = IAuraChunk.getHighestSpot(this.world, this.pos, 45, this.pos);
|
||||
IAuraChunk.getAuraChunk(this.world, pos).drainAura(pos, amountToUse);
|
||||
|
||||
// TODO particles
|
||||
/*PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 20));*/
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 20));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickableTi
|
|||
continue;
|
||||
|
||||
if (this.goalTime > 0) {
|
||||
long current = this.world.getGameTime();
|
||||
long current = this.world.getDayTime();
|
||||
long toAdd = Math.min(75, this.goalTime - current);
|
||||
if (toAdd <= 0) {
|
||||
this.goalTime = 0;
|
||||
|
@ -93,7 +93,7 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickableTi
|
|||
this.sendToClients();
|
||||
}
|
||||
} else if (this.goalTime > 0 && this.world.rand.nextFloat() >= 0.25F) {
|
||||
double angle = Math.toRadians(this.world.getGameTime() * 5F % 360);
|
||||
double angle = Math.toRadians(this.world.getDayTime() * 5F % 360);
|
||||
double x = this.pos.getX() + 0.5 + Math.sin(angle) * 3F;
|
||||
double z = this.pos.getZ() + 0.5 + Math.cos(angle) * 3F;
|
||||
int color = this.goalTime % 24000 > 12000 ? 0xe2e2e2 : 0xffe926;
|
||||
|
|
|
@ -3,6 +3,9 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe;
|
||||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
|
@ -61,20 +64,19 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile
|
|||
Multiblocks.TREE_RITUAL.forEach(this.ritualPos, 'W', (pos, matcher) -> {
|
||||
TileEntity tile = this.world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityWoodStand && !((TileEntityWoodStand) tile).items.getStackInSlot(0).isEmpty()) {
|
||||
// TODO particles
|
||||
/* PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticleStream(
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticleStream(
|
||||
(float) pos.getX() + 0.2F + this.world.rand.nextFloat() * 0.6F,
|
||||
(float) pos.getY() + 0.85F,
|
||||
(float) pos.getZ() + 0.2F + this.world.rand.nextFloat() * 0.6F,
|
||||
this.ritualPos.getX() + 0.5F, this.ritualPos.getY() + this.world.rand.nextFloat() * 3F + 2F, this.ritualPos.getZ() + 0.5F,
|
||||
this.world.rand.nextFloat() * 0.04F + 0.04F, 0x89cc37, this.world.rand.nextFloat() * 1F + 1F
|
||||
));*/
|
||||
));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
/* PacketHandler.sendToAllAround(this.world, this.ritualPos, 32,
|
||||
new PacketParticles(this.ritualPos.getX(), this.ritualPos.getY(), this.ritualPos.getZ(), 0));*/
|
||||
PacketHandler.sendToAllAround(this.world, this.ritualPos, 32,
|
||||
new PacketParticles(this.ritualPos.getX(), this.ritualPos.getY(), this.ritualPos.getZ(), 0));
|
||||
|
||||
if (this.timer >= this.recipe.time) {
|
||||
this.recurseTreeDestruction(this.ritualPos, this.ritualPos);
|
||||
|
@ -88,8 +90,8 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile
|
|||
this.recipe.result.copy());
|
||||
this.world.addEntity(item);
|
||||
|
||||
/*PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 3));*/
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 3));
|
||||
this.world.playSound(null, this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5,
|
||||
SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.BLOCKS, 0.65F, 1F);
|
||||
|
||||
|
@ -102,8 +104,8 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile
|
|||
if (tile instanceof TileEntityWoodStand) {
|
||||
TileEntityWoodStand stand = (TileEntityWoodStand) tile;
|
||||
if (!stand.items.getStackInSlot(0).isEmpty()) {
|
||||
/* PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles(stand.pos.getX(), stand.pos.getY(), stand.pos.getZ(), 1));*/
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles(stand.pos.getX(), stand.pos.getY(), stand.pos.getZ(), 1));
|
||||
this.world.playSound(null, stand.pos.getX() + 0.5, stand.pos.getY() + 0.5, stand.pos.getZ() + 0.5,
|
||||
SoundEvents.BLOCK_WOOD_STEP, SoundCategory.BLOCKS, 0.5F, 1F);
|
||||
|
||||
|
@ -139,7 +141,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile
|
|||
BlockState state = this.world.getBlockState(offset);
|
||||
if (state.getBlock() instanceof LogBlock || state.getBlock() instanceof LeavesBlock) {
|
||||
this.world.setBlockState(offset, Blocks.AIR.getDefaultState());
|
||||
//PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 2));
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 2));
|
||||
|
||||
this.recurseTreeDestruction(offset, start);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.packet.PacketAuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
@ -12,6 +14,7 @@ import net.minecraft.nbt.ListNBT;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import org.apache.commons.lang3.mutable.MutableInt;
|
||||
|
@ -113,8 +116,9 @@ public class AuraChunk implements IAuraChunk {
|
|||
private void addDrainSpot(BlockPos pos, MutableInt spot) {
|
||||
int expX = pos.getX() >> 4;
|
||||
int expZ = pos.getZ() >> 4;
|
||||
if (expX != this.chunk.getPos().x || expZ != this.chunk.getPos().z)
|
||||
throw new IllegalArgumentException("Tried to add drain spot " + pos + " to chunk at " + this.chunk.getPos().x + ", " + this.chunk.getPos().z + " when it should've been added to chunk at " + expX + ", " + expZ);
|
||||
ChunkPos myPos = this.chunk.getPos();
|
||||
if (expX != myPos.x || expZ != myPos.z)
|
||||
throw new IllegalArgumentException("Tried to add drain spot " + pos + " to chunk at " + myPos.x + ", " + myPos.z + " when it should've been added to chunk at " + expX + ", " + expZ);
|
||||
|
||||
this.drainSpots.put(pos, spot);
|
||||
}
|
||||
|
@ -147,19 +151,18 @@ public class AuraChunk implements IAuraChunk {
|
|||
}
|
||||
|
||||
if (this.needsSync) {
|
||||
// TODO packets
|
||||
/*PacketHandler.sendToAllLoaded(world,
|
||||
new BlockPos(this.chunk.x * 16, 0, this.chunk.z * 16),
|
||||
this.makePacket());*/
|
||||
ChunkPos pos = this.chunk.getPos();
|
||||
PacketHandler.sendToAllLoaded(world,
|
||||
new BlockPos(pos.x * 16, 0, pos.z * 16),
|
||||
this.makePacket());
|
||||
this.needsSync = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public IMessage makePacket() {
|
||||
return new PacketAuraChunk(this.chunk.x, this.chunk.z, this.drainSpots);
|
||||
public PacketAuraChunk makePacket() {
|
||||
ChunkPos pos = this.chunk.getPos();
|
||||
return new PacketAuraChunk(pos.x, pos.z, this.drainSpots);
|
||||
}
|
||||
*/
|
||||
|
||||
public void getSpotsInArea(BlockPos pos, int radius, BiConsumer<BlockPos, Integer> consumer) {
|
||||
for (Map.Entry<BlockPos, MutableInt> entry : this.drainSpots.entrySet()) {
|
||||
|
|
|
@ -6,6 +6,8 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -75,9 +77,8 @@ public class PlantBoostEffect implements IDrainSpotEffect {
|
|||
BlockPos closestSpot = IAuraChunk.getHighestSpot(world, plantPos, 25, pos);
|
||||
IAuraChunk.getAuraChunk(world, closestSpot).drainAura(closestSpot, 3500);
|
||||
|
||||
// TODO particles
|
||||
/* PacketHandler.sendToAllAround(world, plantPos, 32,
|
||||
new PacketParticles(plantPos.getX(), plantPos.getY(), plantPos.getZ(), 6));*/
|
||||
PacketHandler.sendToAllAround(world, plantPos, 32,
|
||||
new PacketParticles(plantPos.getX(), plantPos.getY(), plantPos.getZ(), 6));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package de.ellpeck.naturesaura.entities;
|
|||
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -48,13 +50,12 @@ public class EntityMoverMinecart extends AbstractMinecartEntity {
|
|||
BlockPos pos = this.getPosition();
|
||||
|
||||
if (!this.spotOffsets.isEmpty() && this.world.getGameTime() % 10 == 0)
|
||||
// TODO particles
|
||||
/*PacketHandler.sendToAllAround(this.world, pos, 32, new PacketParticles(
|
||||
PacketHandler.sendToAllAround(this.world, pos, 32, new PacketParticles(
|
||||
(float) this.posX, (float) this.posY, (float) this.posZ, 22,
|
||||
MathHelper.floor(this.motionX * 100F), MathHelper.floor(this.motionY * 100F), MathHelper.floor(this.motionZ * 100F)));*/
|
||||
MathHelper.floor(this.getMotion().getX() * 100F), MathHelper.floor(this.getMotion().getY() * 100F), MathHelper.floor(this.getMotion().getZ() * 100F)));
|
||||
|
||||
if (pos.distanceSq(this.lastPosition) < 8 * 8)
|
||||
return;
|
||||
if (pos.distanceSq(this.lastPosition) < 8 * 8)
|
||||
return;
|
||||
|
||||
this.moveAura(this.world, this.lastPosition, this.world, pos);
|
||||
this.lastPosition = pos;
|
||||
|
|
|
@ -16,6 +16,7 @@ import de.ellpeck.naturesaura.compat.Compat;
|
|||
import de.ellpeck.naturesaura.items.AuraCache;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import de.ellpeck.naturesaura.items.RangeVisualizer;
|
||||
import de.ellpeck.naturesaura.packet.PacketAuraChunk;
|
||||
import de.ellpeck.naturesaura.particles.ParticleHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -54,6 +55,7 @@ import org.apache.commons.lang3.mutable.MutableInt;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -65,9 +67,12 @@ public class ClientEvents {
|
|||
public static final ResourceLocation BOOK_GUI = new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/book.png");
|
||||
private static final ItemStack ITEM_FRAME = new ItemStack(Items.ITEM_FRAME);
|
||||
private static final Map<ResourceLocation, Tuple<ItemStack, Boolean>> SHOWING_EFFECTS = new HashMap<>();
|
||||
public static final List<PacketAuraChunk> PENDING_AURA_CHUNKS = new ArrayList<>();
|
||||
private static ItemStack heldCache = ItemStack.EMPTY;
|
||||
private static ItemStack heldEye = ItemStack.EMPTY;
|
||||
private static ItemStack heldOcular = ItemStack.EMPTY;
|
||||
private float height;
|
||||
private float previousHeight;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDebugRender(RenderGameOverlayEvent.Text event) {
|
||||
|
@ -97,13 +102,12 @@ public class ClientEvents {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onRenderLast(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
ParticleHandler.renderParticles(event.getPartialTicks());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientTick(TickEvent.ClientTickEvent event) {
|
||||
if (event.phase == TickEvent.Phase.END) {
|
||||
if (event.phase != TickEvent.Phase.END) {
|
||||
heldCache = ItemStack.EMPTY;
|
||||
heldEye = ItemStack.EMPTY;
|
||||
heldOcular = ItemStack.EMPTY;
|
||||
|
@ -112,55 +116,64 @@ public class ClientEvents {
|
|||
if (mc.world == null) {
|
||||
ParticleHandler.clearParticles();
|
||||
RangeVisualizer.clear();
|
||||
} else if (!mc.isGamePaused()) {
|
||||
if (mc.world.getGameTime() % 20 == 0) {
|
||||
int amount = MathHelper.floor(190 * ModConfig.client.excessParticleAmount);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
int x = MathHelper.floor(mc.player.posX) + mc.world.rand.nextInt(64) - 32;
|
||||
int z = MathHelper.floor(mc.player.posZ) + mc.world.rand.nextInt(64) - 32;
|
||||
BlockPos pos = new BlockPos(x, mc.world.getHeight(Heightmap.Type.WORLD_SURFACE, x, z) - 1, z);
|
||||
BlockState state = mc.world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
if (block instanceof IGrowable || block instanceof IPlantable || block instanceof LeavesBlock) {
|
||||
int excess = IAuraChunk.triangulateAuraInArea(mc.world, pos, 45) - IAuraChunk.DEFAULT_AURA;
|
||||
if (excess > 0) {
|
||||
int chance = Math.max(10, 50 - excess / 25000);
|
||||
if (mc.world.rand.nextInt(chance) <= 0)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
pos.getX() + mc.world.rand.nextFloat(),
|
||||
pos.getY() + 0.5F,
|
||||
pos.getZ() + mc.world.rand.nextFloat(),
|
||||
mc.world.rand.nextGaussian() * 0.01F,
|
||||
mc.world.rand.nextFloat() * 0.025F,
|
||||
mc.world.rand.nextGaussian() * 0.01F,
|
||||
BiomeColors.getFoliageColor(mc.world, pos),
|
||||
Math.min(2F, 1F + mc.world.rand.nextFloat() * (excess / 30000F)),
|
||||
Math.min(300, 100 + mc.world.rand.nextInt(excess / 3000 + 1)),
|
||||
0F, false, true);
|
||||
PENDING_AURA_CHUNKS.clear();
|
||||
} else {
|
||||
PENDING_AURA_CHUNKS.removeIf(next -> next.tryHandle(mc.world));
|
||||
|
||||
if (mc.player != null) {
|
||||
this.previousHeight = this.height;
|
||||
this.height += (mc.player.getEyeHeight() - this.height) * 0.5F;
|
||||
}
|
||||
|
||||
if (!mc.isGamePaused()) {
|
||||
if (mc.world.getGameTime() % 20 == 0) {
|
||||
int amount = MathHelper.floor(190 * ModConfig.client.excessParticleAmount);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
int x = MathHelper.floor(mc.player.posX) + mc.world.rand.nextInt(64) - 32;
|
||||
int z = MathHelper.floor(mc.player.posZ) + mc.world.rand.nextInt(64) - 32;
|
||||
BlockPos pos = new BlockPos(x, mc.world.getHeight(Heightmap.Type.WORLD_SURFACE, x, z) - 1, z);
|
||||
BlockState state = mc.world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
if (block instanceof IGrowable || block instanceof IPlantable || block instanceof LeavesBlock) {
|
||||
int excess = IAuraChunk.triangulateAuraInArea(mc.world, pos, 45) - IAuraChunk.DEFAULT_AURA;
|
||||
if (excess > 0) {
|
||||
int chance = Math.max(10, 50 - excess / 25000);
|
||||
if (mc.world.rand.nextInt(chance) <= 0)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
pos.getX() + mc.world.rand.nextFloat(),
|
||||
pos.getY() + 0.5F,
|
||||
pos.getZ() + mc.world.rand.nextFloat(),
|
||||
mc.world.rand.nextGaussian() * 0.01F,
|
||||
mc.world.rand.nextFloat() * 0.025F,
|
||||
mc.world.rand.nextGaussian() * 0.01F,
|
||||
BiomeColors.getFoliageColor(mc.world, pos),
|
||||
Math.min(2F, 1F + mc.world.rand.nextFloat() * (excess / 30000F)),
|
||||
Math.min(300, 100 + mc.world.rand.nextInt(excess / 3000 + 1)),
|
||||
0F, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Helper.isHoldingItem(mc.player, ModItems.RANGE_VISUALIZER) && mc.world.getGameTime() % 5 == 0) {
|
||||
NaturesAuraAPI.IInternalHooks inst = NaturesAuraAPI.instance();
|
||||
inst.setParticleSpawnRange(512);
|
||||
inst.setParticleDepth(false);
|
||||
for (BlockPos pos : RangeVisualizer.VISUALIZED_RAILS.get(mc.world.getDimension().getType())) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
pos.getX() + mc.world.rand.nextFloat(),
|
||||
pos.getY() + mc.world.rand.nextFloat(),
|
||||
pos.getZ() + mc.world.rand.nextFloat(),
|
||||
0F, 0F, 0F, 0xe0faff, mc.world.rand.nextFloat() * 5 + 1, 100, 0F, false, true);
|
||||
if (Helper.isHoldingItem(mc.player, ModItems.RANGE_VISUALIZER) && mc.world.getGameTime() % 5 == 0) {
|
||||
NaturesAuraAPI.IInternalHooks inst = NaturesAuraAPI.instance();
|
||||
inst.setParticleSpawnRange(512);
|
||||
inst.setParticleDepth(false);
|
||||
for (BlockPos pos : RangeVisualizer.VISUALIZED_RAILS.get(mc.world.getDimension().getType())) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
pos.getX() + mc.world.rand.nextFloat(),
|
||||
pos.getY() + mc.world.rand.nextFloat(),
|
||||
pos.getZ() + mc.world.rand.nextFloat(),
|
||||
0F, 0F, 0F, 0xe0faff, mc.world.rand.nextFloat() * 5 + 1, 100, 0F, false, true);
|
||||
}
|
||||
inst.setParticleDepth(true);
|
||||
inst.setParticleSpawnRange(32);
|
||||
}
|
||||
inst.setParticleDepth(true);
|
||||
inst.setParticleSpawnRange(32);
|
||||
}
|
||||
|
||||
ParticleHandler.updateParticles();
|
||||
ParticleHandler.updateParticles();
|
||||
|
||||
if (Compat.baubles) {
|
||||
// TODO baubles
|
||||
if (Compat.baubles) {
|
||||
// TODO baubles
|
||||
/*IItemHandler baubles = BaublesApi.getBaublesHandler(mc.player);
|
||||
for (int i = 0; i < baubles.getSlots(); i++) {
|
||||
ItemStack slot = baubles.getStackInSlot(i);
|
||||
|
@ -173,24 +186,25 @@ public class ClientEvents {
|
|||
heldOcular = slot;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack slot = mc.player.inventory.getStackInSlot(i);
|
||||
if (!slot.isEmpty()) {
|
||||
if (slot.getItem() instanceof AuraCache)
|
||||
heldCache = slot;
|
||||
else if (slot.getItem() == ModItems.EYE && i <= 8)
|
||||
heldEye = slot;
|
||||
else if (slot.getItem() == ModItems.EYE_IMPROVED)
|
||||
heldOcular = slot;
|
||||
}
|
||||
}
|
||||
|
||||
if (!heldOcular.isEmpty() && mc.world.getGameTime() % 20 == 0) {
|
||||
SHOWING_EFFECTS.clear();
|
||||
Helper.getAuraChunksInArea(mc.world, mc.player.getPosition(), 100,
|
||||
chunk -> chunk.getActiveEffectIcons(mc.player, SHOWING_EFFECTS));
|
||||
for (int i = 0; i < mc.player.inventory.getSizeInventory(); i++) {
|
||||
ItemStack slot = mc.player.inventory.getStackInSlot(i);
|
||||
if (!slot.isEmpty()) {
|
||||
if (slot.getItem() instanceof AuraCache)
|
||||
heldCache = slot;
|
||||
else if (slot.getItem() == ModItems.EYE && i <= 8)
|
||||
heldEye = slot;
|
||||
else if (slot.getItem() == ModItems.EYE_IMPROVED)
|
||||
heldOcular = slot;
|
||||
}
|
||||
}
|
||||
|
||||
if (!heldOcular.isEmpty() && mc.world.getGameTime() % 20 == 0) {
|
||||
SHOWING_EFFECTS.clear();
|
||||
Helper.getAuraChunksInArea(mc.world, mc.player.getPosition(), 100,
|
||||
chunk -> chunk.getActiveEffectIcons(mc.player, SHOWING_EFFECTS));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +217,7 @@ public class ClientEvents {
|
|||
float partial = event.getPartialTicks();
|
||||
GL11.glTranslated(
|
||||
-mc.player.prevPosX - (mc.player.posX - mc.player.prevPosX) * partial,
|
||||
-mc.player.prevPosY - (mc.player.posY - mc.player.prevPosY) * partial,
|
||||
-mc.player.prevPosY - (mc.player.posY - mc.player.prevPosY) * partial - (double) MathHelper.lerp(partial, this.previousHeight, this.height),
|
||||
-mc.player.prevPosZ - (mc.player.posZ - mc.player.prevPosZ) * partial);
|
||||
|
||||
if (mc.gameSettings.showDebugInfo && mc.player.isCreative() && ModConfig.client.debugWorld) {
|
||||
|
@ -271,7 +285,8 @@ public class ClientEvents {
|
|||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderVisualize(IVisualizable visualize, World world, BlockPos pos) {
|
||||
private void renderVisualize(IVisualizable visualize, World
|
||||
world, BlockPos pos) {
|
||||
AxisAlignedBB box = visualize.getVisualizationBounds(world, pos);
|
||||
if (box == null)
|
||||
return;
|
||||
|
@ -306,7 +321,7 @@ public class ClientEvents {
|
|||
float scale = 0.75F;
|
||||
GlStateManager.scalef(scale, scale, scale);
|
||||
String s = heldCache.getDisplayName().getFormattedText();
|
||||
mc.fontRenderer.drawString(s, (x + 80) / scale - mc.fontRenderer.getStringWidth(s), (y - 7) / scale, color);
|
||||
mc.fontRenderer.drawStringWithShadow(s, (x + 80) / scale - mc.fontRenderer.getStringWidth(s), (y - 7) / scale, color);
|
||||
|
||||
GlStateManager.color3f(1F, 1F, 1F);
|
||||
GlStateManager.popMatrix();
|
||||
|
@ -357,13 +372,13 @@ public class ClientEvents {
|
|||
|
||||
int color = heldOcular.isEmpty() ? 0x53a008 : 0xa05308;
|
||||
if (totalPercentage > (heldOcular.isEmpty() ? 1F : 1.5F))
|
||||
mc.fontRenderer.drawString("+", startX + plusOffX, startY - 0.5F, color);
|
||||
mc.fontRenderer.drawStringWithShadow("+", startX + plusOffX, startY - 0.5F, color);
|
||||
if (totalPercentage < (heldOcular.isEmpty() ? 0F : -0.5F))
|
||||
mc.fontRenderer.drawString("-", startX + plusOffX, startY - 0.5F + (heldOcular.isEmpty() ? 44 : 70), color);
|
||||
mc.fontRenderer.drawStringWithShadow("-", startX + plusOffX, startY - 0.5F + (heldOcular.isEmpty() ? 44 : 70), color);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scalef(textScale, textScale, textScale);
|
||||
mc.fontRenderer.drawString(text, textX / textScale, textY / textScale, 0x53a008);
|
||||
mc.fontRenderer.drawStringWithShadow(text, textX / textScale, textY / textScale, 0x53a008);
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
if (!heldOcular.isEmpty()) {
|
||||
|
@ -398,7 +413,7 @@ public class ClientEvents {
|
|||
BlockState state = mc.world.getBlockState(pos);
|
||||
ItemStack blockStack = state.getBlock().getPickBlock(state, mc.objectMouseOver, mc.world, pos, mc.player);
|
||||
this.drawContainerInfo(container.getStoredAura(), container.getMaxAura(), container.getAuraColor(),
|
||||
mc, res, 35, blockStack.getDisplayName().toString(), null);
|
||||
mc, res, 35, blockStack.getDisplayName().getFormattedText(), null);
|
||||
|
||||
if (tile instanceof TileEntityNatureAltar) {
|
||||
ItemStack tileStack = ((TileEntityNatureAltar) tile).getItemHandler(null).getStackInSlot(0);
|
||||
|
@ -406,7 +421,7 @@ public class ClientEvents {
|
|||
IAuraContainer stackCont = tileStack.getCapability(NaturesAuraAPI.capAuraContainer, null).orElse(null);
|
||||
if (stackCont != null) {
|
||||
this.drawContainerInfo(stackCont.getStoredAura(), stackCont.getMaxAura(), stackCont.getAuraColor(),
|
||||
mc, res, 55, tileStack.getDisplayName().toString(), null);
|
||||
mc, res, 55, tileStack.getDisplayName().getFormattedText(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -422,7 +437,7 @@ public class ClientEvents {
|
|||
int x = res.getScaledWidth() / 2;
|
||||
int y = res.getScaledHeight() / 2;
|
||||
if (stack.isEmpty())
|
||||
mc.fontRenderer.drawString(
|
||||
mc.fontRenderer.drawStringWithShadow(
|
||||
TextFormatting.GRAY.toString() + TextFormatting.ITALIC + I18n.format("info.naturesaura.empty"),
|
||||
x + 5, y - 11, 0xFFFFFF);
|
||||
else
|
||||
|
@ -445,7 +460,9 @@ public class ClientEvents {
|
|||
}
|
||||
}
|
||||
|
||||
private void drawContainerInfo(int stored, int max, int color, Minecraft mc, MainWindow res, int yOffset, String name, String textBelow) {
|
||||
private void drawContainerInfo(int stored, int max,
|
||||
int color, Minecraft mc, MainWindow res, int yOffset, String name, String
|
||||
textBelow) {
|
||||
GlStateManager.color3f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F);
|
||||
|
||||
int x = res.getScaledWidth() / 2 - 40;
|
||||
|
@ -458,9 +475,9 @@ public class ClientEvents {
|
|||
if (width > 0)
|
||||
AbstractGui.blit(x, y, 0, 6, width, 6, 256, 256);
|
||||
|
||||
mc.fontRenderer.drawString(name, x + 40 - mc.fontRenderer.getStringWidth(name) / 2F, y - 9, color);
|
||||
mc.fontRenderer.drawStringWithShadow(name, x + 40 - mc.fontRenderer.getStringWidth(name) / 2F, y - 9, color);
|
||||
|
||||
if (textBelow != null)
|
||||
mc.fontRenderer.drawString(textBelow, x + 40 - mc.fontRenderer.getStringWidth(textBelow) / 2F, y + 7, color);
|
||||
mc.fontRenderer.drawStringWithShadow(textBelow, x + 40 - mc.fontRenderer.getStringWidth(textBelow) / 2F, y + 7, color);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,16 +7,26 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|||
import de.ellpeck.naturesaura.chunk.AuraChunk;
|
||||
import de.ellpeck.naturesaura.chunk.AuraChunkProvider;
|
||||
import de.ellpeck.naturesaura.misc.WorldData;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.server.ChunkHolder;
|
||||
import net.minecraft.world.server.ChunkManager;
|
||||
import net.minecraft.world.server.ServerChunkProvider;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.event.world.ChunkWatchEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class CommonEvents {
|
||||
|
||||
private static final Method GET_LOADED_CHUNKS_METHOD = ObfuscationReflectionHelper.findMethod(ChunkManager.class, "func_223491_f");
|
||||
|
||||
@SubscribeEvent
|
||||
public void onChunkCapsAttach(AttachCapabilitiesEvent<Chunk> event) {
|
||||
Chunk chunk = event.getObject();
|
||||
|
@ -32,13 +42,22 @@ public class CommonEvents {
|
|||
public void onWorldTick(TickEvent.WorldTickEvent event) {
|
||||
if (!event.world.isRemote && event.phase == TickEvent.Phase.END) {
|
||||
if (event.world.getGameTime() % 20 == 0) {
|
||||
// TODO update loaded aura chunks
|
||||
/*Iterator<Chunk> chunks = event.world.getPersistentChunkIterable(((ServerWorld) event.world).getPlayerChunkMap().getChunkIterator());
|
||||
while (chunks.hasNext()) {
|
||||
Chunk chunk = chunks.next();
|
||||
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk, null).orElse(null);
|
||||
auraChunk.update();
|
||||
}*/
|
||||
event.world.getProfiler().startSection(NaturesAura.MOD_ID + ":onWorldTick");
|
||||
try {
|
||||
ChunkManager manager = ((ServerChunkProvider) event.world.getChunkProvider()).chunkManager;
|
||||
Iterable<ChunkHolder> chunks = (Iterable<ChunkHolder>) GET_LOADED_CHUNKS_METHOD.invoke(manager);
|
||||
for (ChunkHolder holder : chunks) {
|
||||
Chunk chunk = holder.func_219298_c();
|
||||
if (chunk == null)
|
||||
continue;
|
||||
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk, null).orElse(null);
|
||||
if (auraChunk != null)
|
||||
auraChunk.update();
|
||||
}
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
NaturesAura.LOGGER.fatal(e);
|
||||
}
|
||||
event.world.getProfiler().endSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,9 +81,8 @@ public class CommonEvents {
|
|||
Chunk chunk = event.getWorld().getChunk(event.getPos().x, event.getPos().z);
|
||||
if (!chunk.getWorld().isRemote) {
|
||||
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk, null).orElse(null);
|
||||
// TODO packets
|
||||
/*if (auraChunk != null)
|
||||
PacketHandler.sendTo(event.getPlayer(), auraChunk.makePacket());*/
|
||||
if (auraChunk != null)
|
||||
PacketHandler.sendTo(event.getPlayer(), auraChunk.makePacket());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import de.ellpeck.naturesaura.NaturesAura;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.render.ITrinketItem;
|
||||
import de.ellpeck.naturesaura.items.tools.Armor;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -105,7 +107,7 @@ public class ShockwaveCreator extends ItemImpl implements ITrinketItem {
|
|||
if (worldIn instanceof ServerWorld)
|
||||
((ServerWorld) worldIn).spawnParticle(ParticleTypes.POOF, living.posX, living.posY + 0.01F, living.posZ, 15, 0D, 0D, 0D, 0.15D);
|
||||
|
||||
// TODO PacketHandler.sendToAllAround(worldIn, pos, 32, new PacketParticles((float) living.posX, (float) living.posY, (float) living.posZ, 11));
|
||||
PacketHandler.sendToAllAround(worldIn, pos, 32, new PacketParticles((float) living.posX, (float) living.posY, (float) living.posZ, 11));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
package de.ellpeck.naturesaura.packet;
|
||||
|
||||
public interface IPacket {
|
||||
}
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.packet;
|
|||
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.chunk.AuraChunk;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import de.ellpeck.naturesaura.events.ClientEvents;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -16,12 +16,21 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class PacketAuraChunk implements IPacket {
|
||||
public class PacketAuraChunk {
|
||||
|
||||
private int chunkX;
|
||||
private int chunkZ;
|
||||
private Map<BlockPos, MutableInt> drainSpots;
|
||||
|
||||
public PacketAuraChunk(int chunkX, int chunkZ, Map<BlockPos, MutableInt> drainSpots) {
|
||||
this.chunkX = chunkX;
|
||||
this.chunkZ = chunkZ;
|
||||
this.drainSpots = drainSpots;
|
||||
}
|
||||
|
||||
private PacketAuraChunk() {
|
||||
}
|
||||
|
||||
public static PacketAuraChunk fromBytes(PacketBuffer buf) {
|
||||
PacketAuraChunk packet = new PacketAuraChunk();
|
||||
packet.chunkX = buf.readInt();
|
||||
|
@ -50,22 +59,20 @@ public class PacketAuraChunk implements IPacket {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Handler {
|
||||
public boolean tryHandle(World world) {
|
||||
Chunk chunk = world.getChunk(this.chunkX, this.chunkZ);
|
||||
if (chunk.isEmpty())
|
||||
return false;
|
||||
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk).orElse(null);
|
||||
if (auraChunk == null)
|
||||
return false;
|
||||
auraChunk.setSpots(this.drainSpots);
|
||||
return true;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void onMessage(PacketAuraChunk message, Supplier<NetworkEvent.Context> ctx) {
|
||||
ctx.get().enqueueWork(() -> {
|
||||
World world = Minecraft.getInstance().world;
|
||||
if (world != null) {
|
||||
Chunk chunk = world.getChunk(message.chunkX, message.chunkZ);
|
||||
|
||||
if (chunk.getCapability(NaturesAuraAPI.capAuraChunk).isPresent()) {
|
||||
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk).orElse(null);
|
||||
auraChunk.setSpots(message.drainSpots);
|
||||
}
|
||||
}
|
||||
});
|
||||
ctx.get().setPacketHandled(true);
|
||||
}
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void onMessage(PacketAuraChunk message, Supplier<NetworkEvent.Context> ctx) {
|
||||
ctx.get().enqueueWork(() -> ClientEvents.PENDING_AURA_CHUNKS.add(message));
|
||||
ctx.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,19 @@ import net.minecraftforge.fml.network.NetworkEvent;
|
|||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class PacketClient implements IPacket {
|
||||
|
||||
public class PacketClient {
|
||||
private int type;
|
||||
private int[] data;
|
||||
|
||||
public PacketClient(int type, int... data) {
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private PacketClient() {
|
||||
|
||||
}
|
||||
|
||||
public static PacketClient fromBytes(PacketBuffer buf) {
|
||||
PacketClient client = new PacketClient();
|
||||
client.type = buf.readByte();
|
||||
|
@ -33,23 +41,19 @@ public class PacketClient implements IPacket {
|
|||
buf.writeInt(i);
|
||||
}
|
||||
|
||||
public static class Handler {
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void onMessage(PacketClient message, Supplier<NetworkEvent.Context> ctx) {
|
||||
ctx.get().enqueueWork(() -> {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.world != null) {
|
||||
switch (message.type) {
|
||||
case 0: // dimension rail visualization
|
||||
int goalDim = message.data[0];
|
||||
BlockPos goalPos = new BlockPos(message.data[1], message.data[2], message.data[3]);
|
||||
RangeVisualizer.visualize(mc.player, RangeVisualizer.VISUALIZED_RAILS, DimensionType.getById(goalDim), goalPos);
|
||||
}
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void onMessage(PacketClient message, Supplier<NetworkEvent.Context> ctx) {
|
||||
ctx.get().enqueueWork(() -> {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.world != null) {
|
||||
switch (message.type) {
|
||||
case 0: // dimension rail visualization
|
||||
int goalDim = message.data[0];
|
||||
BlockPos goalPos = new BlockPos(message.data[1], message.data[2], message.data[3]);
|
||||
RangeVisualizer.visualize(mc.player, RangeVisualizer.VISUALIZED_RAILS, DimensionType.getById(goalDim), goalPos);
|
||||
}
|
||||
});
|
||||
|
||||
ctx.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
ctx.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,37 +12,26 @@ import net.minecraftforge.fml.network.simple.SimpleChannel;
|
|||
|
||||
public final class PacketHandler {
|
||||
|
||||
private static String version = "1";
|
||||
private static final String VERSION = "1";
|
||||
private static SimpleChannel network;
|
||||
|
||||
public static void init() {
|
||||
network = NetworkRegistry.newSimpleChannel(
|
||||
NaturesAura.createRes("network"),
|
||||
() -> version,
|
||||
version::equals,
|
||||
version::equals);
|
||||
network.registerMessage(0, PacketParticleStream.class, PacketParticleStream::toBytes, PacketParticleStream::fromBytes, PacketParticleStream.Handler::onMessage);
|
||||
network.registerMessage(1, PacketParticles.class, PacketParticles::toBytes, PacketParticles::fromBytes, PacketParticles.Handler::onMessage);
|
||||
network.registerMessage(2, PacketAuraChunk.class, PacketAuraChunk::toBytes, PacketAuraChunk::fromBytes, PacketAuraChunk.Handler::onMessage);
|
||||
network.registerMessage(3, PacketClient.class, PacketClient::toBytes, PacketClient::fromBytes, PacketClient.Handler::onMessage);
|
||||
network = NetworkRegistry.newSimpleChannel(NaturesAura.createRes("network"), () -> VERSION, VERSION::equals, VERSION::equals);
|
||||
network.registerMessage(0, PacketParticleStream.class, PacketParticleStream::toBytes, PacketParticleStream::fromBytes, PacketParticleStream::onMessage);
|
||||
network.registerMessage(1, PacketParticles.class, PacketParticles::toBytes, PacketParticles::fromBytes, PacketParticles::onMessage);
|
||||
network.registerMessage(2, PacketAuraChunk.class, PacketAuraChunk::toBytes, PacketAuraChunk::fromBytes, PacketAuraChunk::onMessage);
|
||||
network.registerMessage(3, PacketClient.class, PacketClient::toBytes, PacketClient::fromBytes, PacketClient::onMessage);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void sendToAllLoaded(World world, BlockPos pos, IPacket message) {
|
||||
sendToAllLoaded(message);
|
||||
public static void sendToAllLoaded(World world, BlockPos pos, Object message) {
|
||||
network.send(PacketDistributor.TRACKING_CHUNK.with(() -> world.getChunkAt(pos)), message);
|
||||
}
|
||||
|
||||
public static void sendToAllLoaded(IPacket message) {
|
||||
network.send(PacketDistributor.ALL.noArg(), message);
|
||||
public static void sendToAllAround(IWorld world, BlockPos pos, int range, Object message) {
|
||||
network.send(PacketDistributor.NEAR.with(() -> new PacketDistributor.TargetPoint(pos.getX(), pos.getY(), pos.getZ(), range, world.getDimension().getType())), message);
|
||||
}
|
||||
|
||||
public static void sendToAllAround(IWorld world, BlockPos pos, int range, IPacket message) {
|
||||
network.send(PacketDistributor.NEAR.with(
|
||||
() -> new PacketDistributor.TargetPoint(pos.getX(), pos.getY(), pos.getZ(), range, world.getDimension().getType())),
|
||||
message);
|
||||
}
|
||||
|
||||
public static void sendTo(PlayerEntity player, IPacket message) {
|
||||
public static void sendTo(PlayerEntity player, Object message) {
|
||||
network.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) player), message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package de.ellpeck.naturesaura.packet;
|
||||
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -10,7 +8,7 @@ import net.minecraftforge.fml.network.NetworkEvent;
|
|||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class PacketParticleStream implements IPacket {
|
||||
public class PacketParticleStream {
|
||||
|
||||
private float startX;
|
||||
private float startY;
|
||||
|
@ -36,8 +34,7 @@ public class PacketParticleStream implements IPacket {
|
|||
this.scale = scale;
|
||||
}
|
||||
|
||||
public PacketParticleStream() {
|
||||
|
||||
private PacketParticleStream() {
|
||||
}
|
||||
|
||||
public static PacketParticleStream fromBytes(PacketBuffer buf) {
|
||||
|
@ -68,16 +65,13 @@ public class PacketParticleStream implements IPacket {
|
|||
buf.writeFloat(packet.scale);
|
||||
}
|
||||
|
||||
public static class Handler {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void onMessage(PacketParticleStream message, Supplier<NetworkEvent.Context> ctx) {
|
||||
ctx.get().enqueueWork(() -> NaturesAuraAPI.instance().spawnParticleStream(
|
||||
message.startX, message.startY, message.startZ,
|
||||
message.endX, message.endY, message.endZ,
|
||||
message.speed, message.color, message.scale));
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void onMessage(PacketParticleStream message, Supplier<NetworkEvent.Context> ctx) {
|
||||
ctx.get().enqueueWork(() -> NaturesAuraAPI.instance().spawnParticleStream(
|
||||
message.startX, message.startY, message.startZ,
|
||||
message.endX, message.endY, message.endZ,
|
||||
message.speed, message.color, message.scale));
|
||||
|
||||
ctx.get().setPacketHandled(true);
|
||||
}
|
||||
ctx.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraftforge.fml.network.NetworkEvent;
|
|||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class PacketParticles implements IPacket {
|
||||
public class PacketParticles {
|
||||
|
||||
private float posX;
|
||||
private float posY;
|
||||
|
@ -26,6 +26,17 @@ public class PacketParticles implements IPacket {
|
|||
private int type;
|
||||
private int[] data;
|
||||
|
||||
public PacketParticles(float posX, float posY, float posZ, int type, int... data) {
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
private PacketParticles() {
|
||||
}
|
||||
|
||||
public static PacketParticles fromBytes(PacketBuffer buf) {
|
||||
PacketParticles packet = new PacketParticles();
|
||||
|
||||
|
@ -54,380 +65,376 @@ public class PacketParticles implements IPacket {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Handler {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void onMessage(PacketParticles message, Supplier<NetworkEvent.Context> ctx) {
|
||||
ctx.get().enqueueWork(() -> {
|
||||
World world = Minecraft.getInstance().world;
|
||||
if (world != null) {
|
||||
switch (message.type) {
|
||||
case 0: // Tree ritual: Gold powder
|
||||
BlockPos pos = new BlockPos(message.posX, message.posY, message.posZ);
|
||||
Multiblocks.TREE_RITUAL.forEach(pos, 'G', (dustPos, matcher) -> {
|
||||
BlockState state = world.getBlockState(dustPos);
|
||||
AxisAlignedBB box = state.getShape(world, dustPos).getBoundingBox();
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
dustPos.getX() + box.minX + (box.maxX - box.minX) * world.rand.nextFloat(),
|
||||
dustPos.getY() + 0.1F,
|
||||
dustPos.getZ() + box.minZ + (box.maxZ - box.minZ) * world.rand.nextFloat(),
|
||||
(float) world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextFloat() * 0.01F + 0.02F,
|
||||
(float) world.rand.nextGaussian() * 0.02F,
|
||||
0xf4cb42, 2F, 50, 0F, false, true);
|
||||
return true;
|
||||
});
|
||||
break;
|
||||
case 1: // Tree ritual: Consuming item
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.5F, message.posY + 0.9F, message.posZ + 0.5F,
|
||||
(float) world.rand.nextGaussian() * 0.04F, world.rand.nextFloat() * 0.04F, (float) world.rand.nextGaussian() * 0.04F,
|
||||
0x89cc37, 1.5F, 25, 0F, false, true);
|
||||
}
|
||||
break;
|
||||
case 2: // Tree ritual: Tree disappearing
|
||||
for (int i = world.rand.nextInt(5) + 3; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat(), message.posY + world.rand.nextFloat(), message.posZ + world.rand.nextFloat(),
|
||||
0F, 0F, 0F,
|
||||
0x33FF33, 1F, 50, 0F, false, true);
|
||||
}
|
||||
break;
|
||||
case 3: // Tree ritual: Spawn result item
|
||||
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY, message.posZ,
|
||||
world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F,
|
||||
0x89cc37, 2F, 100, 0F, true, true);
|
||||
}
|
||||
break;
|
||||
case 4: // Nature altar: Conversion
|
||||
for (int i = world.rand.nextInt(5) + 2; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posY + 0.9F + 0.25F * world.rand.nextFloat(),
|
||||
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.02F, world.rand.nextFloat() * 0.02F, world.rand.nextGaussian() * 0.02F,
|
||||
0x00FF00, world.rand.nextFloat() * 1.5F + 0.75F, 20, 0F, false, true);
|
||||
}
|
||||
break;
|
||||
case 5: // Potion generator
|
||||
int color = message.data[0];
|
||||
boolean releaseAura = message.data[1] > 0;
|
||||
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat(),
|
||||
message.posY + 1.1F,
|
||||
message.posZ + world.rand.nextFloat(),
|
||||
world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.1F, world.rand.nextGaussian() * 0.01F,
|
||||
color, 2F + world.rand.nextFloat(), 40, 0F, true, true);
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void onMessage(PacketParticles message, Supplier<NetworkEvent.Context> ctx) {
|
||||
ctx.get().enqueueWork(() -> {
|
||||
World world = Minecraft.getInstance().world;
|
||||
if (world != null) {
|
||||
switch (message.type) {
|
||||
case 0: // Tree ritual: Gold powder
|
||||
BlockPos pos = new BlockPos(message.posX, message.posY, message.posZ);
|
||||
Multiblocks.TREE_RITUAL.forEach(pos, 'G', (dustPos, matcher) -> {
|
||||
BlockState state = world.getBlockState(dustPos);
|
||||
//AxisAlignedBB box = state.getBoundingBox(world, dustPos); // TODO
|
||||
AxisAlignedBB box = state.getShape(world, dustPos).getBoundingBox();
|
||||
if (releaseAura)
|
||||
for (int x = -1; x <= 1; x += 2)
|
||||
for (int z = -1; z <= 1; z += 2) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + x * 3 + 0.5F,
|
||||
message.posY + 2.5,
|
||||
message.posZ + z * 3 + 0.5F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextFloat() * 0.04F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
0xd6340c, 1F + world.rand.nextFloat() * 2F, 75, 0F, true, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6: // Plant boost effect
|
||||
for (int i = world.rand.nextInt(20) + 15; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat(),
|
||||
message.posY + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posZ + world.rand.nextFloat(),
|
||||
0F, world.rand.nextFloat() * 0.02F, 0F,
|
||||
0x5ccc30, 1F + world.rand.nextFloat() * 2F, 50, 0F, false, true);
|
||||
|
||||
break;
|
||||
case 7: // Flower generator consumation
|
||||
color = message.data[0];
|
||||
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posY + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
color, world.rand.nextFloat() * 2F + 1F, 25, 0F, false, true);
|
||||
break;
|
||||
case 8: // Flower generator, firework generator aura creation
|
||||
for (int i = world.rand.nextInt(10) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.04F + 0.02F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
break;
|
||||
case 9: // Placer placing
|
||||
for (int i = world.rand.nextInt(20) + 20; i >= 0; i--) {
|
||||
boolean side = world.rand.nextBoolean();
|
||||
float x = side ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
||||
float z = !side ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + x, message.posY + 0.1F + world.rand.nextFloat() * 0.98F, message.posZ + z,
|
||||
0F, 0F, 0F,
|
||||
0xad7a37, world.rand.nextFloat() + 1F, 50, 0F, true, true);
|
||||
}
|
||||
break;
|
||||
case 10: // Hopper upgrade picking up
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.45F, message.posZ,
|
||||
world.rand.nextGaussian() * 0.015F,
|
||||
world.rand.nextGaussian() * 0.015F,
|
||||
world.rand.nextGaussian() * 0.015F,
|
||||
0xdde7ff, world.rand.nextFloat() + 1F, 30, -0.06F, true, true);
|
||||
break;
|
||||
case 11: // Shockwave creator particles
|
||||
for (int i = 0; i < 360; i += 2) {
|
||||
double rad = Math.toRadians(i);
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.01F, message.posZ,
|
||||
(float) Math.sin(rad) * 0.65F,
|
||||
0F,
|
||||
(float) Math.cos(rad) * 0.65F,
|
||||
0x911b07, 3F, 10, 0F, false, true);
|
||||
}
|
||||
break;
|
||||
case 12: // Oak generator
|
||||
int sapX = message.data[0];
|
||||
int sapY = message.data[1];
|
||||
int sapZ = message.data[2];
|
||||
releaseAura = message.data[3] > 0;
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
sapX + 0.5F + (float) world.rand.nextGaussian() * 3F,
|
||||
sapY + 0.5F + world.rand.nextFloat() * 4F,
|
||||
sapZ + 0.5F + (float) world.rand.nextGaussian() * 3F,
|
||||
message.posX + 0.5F,
|
||||
message.posY + 0.5F,
|
||||
message.posZ + 0.5F,
|
||||
0.6F, BiomeColors.getFoliageColor(world, new BlockPos(sapX, sapY, sapZ)), 1.5F);
|
||||
if (releaseAura)
|
||||
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
dustPos.getX() + box.minX + (box.maxX - box.minX) * world.rand.nextFloat(),
|
||||
dustPos.getY() + 0.1F,
|
||||
dustPos.getZ() + box.minZ + (box.maxZ - box.minZ) * world.rand.nextFloat(),
|
||||
(float) world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextFloat() * 0.01F + 0.02F,
|
||||
(float) world.rand.nextGaussian() * 0.02F,
|
||||
0xf4cb42, 2F, 50, 0F, false, true);
|
||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.03F,
|
||||
world.rand.nextFloat() * 0.04F + 0.04F,
|
||||
world.rand.nextGaussian() * 0.03F,
|
||||
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 60, 0F, false, true);
|
||||
break;
|
||||
case 13: // Offering table
|
||||
int genX = message.data[0];
|
||||
int genY = message.data[1];
|
||||
int genZ = message.data[2];
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextFloat() * 0.25F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
0xffadfd, 1.5F, 40, 0F, false, true);
|
||||
for (int i = world.rand.nextInt(50) + 30; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
genX + 0.5F + world.rand.nextGaussian() * 2.5F,
|
||||
genY + 0.1F,
|
||||
genZ + 0.5F + world.rand.nextGaussian() * 2.5F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.01F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0xd3e4ff, 1.5F, 150, 0F, false, true);
|
||||
break;
|
||||
case 14: // Pickup stopper
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.4F, message.posZ,
|
||||
world.rand.nextGaussian() * 0.005F,
|
||||
world.rand.nextFloat() * 0.005F,
|
||||
world.rand.nextGaussian() * 0.005F,
|
||||
0xcc3116, 1.5F, 40, 0F, false, true);
|
||||
break;
|
||||
case 15: // Spawn lamp
|
||||
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.3F + world.rand.nextFloat() * 0.4F,
|
||||
message.posY + 0.15F + world.rand.nextFloat() * 0.5F,
|
||||
message.posZ + 0.3F + world.rand.nextFloat() * 0.4F,
|
||||
0F, 0F, 0F,
|
||||
0xf4a142, 1F, 30, 0F, false, true);
|
||||
break;
|
||||
case 16: // Animal generator aura creation
|
||||
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.04F + 0.02F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0xd13308, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
break;
|
||||
case 17: // Animal generator consuming
|
||||
boolean child = message.data[0] > 0;
|
||||
float height = message.data[1] / 10F;
|
||||
genX = message.data[2];
|
||||
genY = message.data[3];
|
||||
genZ = message.data[4];
|
||||
for (int i = (child ? world.rand.nextInt(10) + 10 : world.rand.nextInt(20) + 20); i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextGaussian() * 0.25F,
|
||||
message.posY + height * 0.75F + world.rand.nextGaussian() * 0.25F,
|
||||
message.posZ + world.rand.nextGaussian() * 0.25F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.01F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0x42f4c8, world.rand.nextFloat() * (child ? 0.5F : 2F) + 1F, world.rand.nextInt(30) + 40, 0F, true, true);
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
message.posX, message.posY + height * 0.75F, message.posZ,
|
||||
genX + 0.5F, genY + 0.5F, genZ + 0.5F,
|
||||
0.15F, 0x41c4f4, child ? 1.5F : 3F);
|
||||
break;
|
||||
case 18: // End flower decay
|
||||
color = message.data[0];
|
||||
for (int i = world.rand.nextInt(10) + 20; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat(),
|
||||
message.posY + world.rand.nextFloat(),
|
||||
message.posZ + world.rand.nextFloat(),
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.01F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
color, 1.5F, 80, 0F, true, true);
|
||||
break;
|
||||
case 19: // Animal spawner, auto crafter
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextFloat() * 0.02F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
0x16b7b2, 1.5F, 40, 0F, false, true);
|
||||
break;
|
||||
case 20: // RF converter
|
||||
for (int i = world.rand.nextInt(5) + 2; i >= 0; i--)
|
||||
Multiblocks.RF_CONVERTER.forEach(new BlockPos(message.posX, message.posY, message.posZ), 'R', (blockPos, matcher) -> {
|
||||
if (world.rand.nextFloat() < 0.35F) {
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
blockPos.getX() + world.rand.nextFloat(),
|
||||
blockPos.getY() + world.rand.nextFloat(),
|
||||
blockPos.getZ() + world.rand.nextFloat(),
|
||||
message.posX + world.rand.nextFloat(),
|
||||
message.posY + world.rand.nextFloat(),
|
||||
message.posZ + world.rand.nextFloat(),
|
||||
0.05F, 0xff1a05, 1.5F);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
break;
|
||||
case 1: // Tree ritual: Consuming item
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.5F, message.posY + 0.9F, message.posZ + 0.5F,
|
||||
(float) world.rand.nextGaussian() * 0.04F, world.rand.nextFloat() * 0.04F, (float) world.rand.nextGaussian() * 0.04F,
|
||||
0x89cc37, 1.5F, 25, 0F, false, true);
|
||||
}
|
||||
break;
|
||||
case 2: // Tree ritual: Tree disappearing
|
||||
for (int i = world.rand.nextInt(5) + 3; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat(), message.posY + world.rand.nextFloat(), message.posZ + world.rand.nextFloat(),
|
||||
0F, 0F, 0F,
|
||||
0x33FF33, 1F, 50, 0F, false, true);
|
||||
}
|
||||
break;
|
||||
case 3: // Tree ritual: Spawn result item
|
||||
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY, message.posZ,
|
||||
world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F, world.rand.nextGaussian() * 0.1F,
|
||||
0x89cc37, 2F, 100, 0F, true, true);
|
||||
}
|
||||
break;
|
||||
case 4: // Nature altar: Conversion
|
||||
for (int i = world.rand.nextInt(5) + 2; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posY + 0.9F + 0.25F * world.rand.nextFloat(),
|
||||
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.02F, world.rand.nextFloat() * 0.02F, world.rand.nextGaussian() * 0.02F,
|
||||
0x00FF00, world.rand.nextFloat() * 1.5F + 0.75F, 20, 0F, false, true);
|
||||
}
|
||||
break;
|
||||
case 5: // Potion generator
|
||||
int color = message.data[0];
|
||||
boolean releaseAura = message.data[1] > 0;
|
||||
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat(),
|
||||
message.posY + 1.1F,
|
||||
message.posZ + world.rand.nextFloat(),
|
||||
world.rand.nextGaussian() * 0.01F, world.rand.nextFloat() * 0.1F, world.rand.nextGaussian() * 0.01F,
|
||||
color, 2F + world.rand.nextFloat(), 40, 0F, true, true);
|
||||
|
||||
if (releaseAura)
|
||||
for (int x = -1; x <= 1; x += 2)
|
||||
for (int z = -1; z <= 1; z += 2) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + x * 3 + 0.5F,
|
||||
message.posY + 2.5,
|
||||
message.posZ + z * 3 + 0.5F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextFloat() * 0.04F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
0xd6340c, 1F + world.rand.nextFloat() * 2F, 75, 0F, true, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6: // Plant boost effect
|
||||
for (int i = world.rand.nextInt(20) + 15; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat(),
|
||||
message.posY + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posZ + world.rand.nextFloat(),
|
||||
0F, world.rand.nextFloat() * 0.02F, 0F,
|
||||
0x5ccc30, 1F + world.rand.nextFloat() * 2F, 50, 0F, false, true);
|
||||
|
||||
break;
|
||||
case 7: // Flower generator consumation
|
||||
color = message.data[0];
|
||||
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posY + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
color, world.rand.nextFloat() * 2F + 1F, 25, 0F, false, true);
|
||||
break;
|
||||
case 8: // Flower generator, firework generator aura creation
|
||||
for (int i = world.rand.nextInt(10) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.04F + 0.02F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
break;
|
||||
case 9: // Placer placing
|
||||
for (int i = world.rand.nextInt(20) + 20; i >= 0; i--) {
|
||||
boolean side = world.rand.nextBoolean();
|
||||
float x = side ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
||||
float z = !side ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + x, message.posY + 0.1F + world.rand.nextFloat() * 0.98F, message.posZ + z,
|
||||
0F, 0F, 0F,
|
||||
0xad7a37, world.rand.nextFloat() + 1F, 50, 0F, true, true);
|
||||
}
|
||||
break;
|
||||
case 10: // Hopper upgrade picking up
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.45F, message.posZ,
|
||||
world.rand.nextGaussian() * 0.015F,
|
||||
world.rand.nextGaussian() * 0.015F,
|
||||
world.rand.nextGaussian() * 0.015F,
|
||||
0xdde7ff, world.rand.nextFloat() + 1F, 30, -0.06F, true, true);
|
||||
break;
|
||||
case 11: // Shockwave creator particles
|
||||
for (int i = 0; i < 360; i += 2) {
|
||||
double rad = Math.toRadians(i);
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.01F, message.posZ,
|
||||
(float) Math.sin(rad) * 0.65F,
|
||||
0F,
|
||||
(float) Math.cos(rad) * 0.65F,
|
||||
0x911b07, 3F, 10, 0F, false, true);
|
||||
}
|
||||
break;
|
||||
case 12: // Oak generator
|
||||
int sapX = message.data[0];
|
||||
int sapY = message.data[1];
|
||||
int sapZ = message.data[2];
|
||||
releaseAura = message.data[3] > 0;
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
sapX + 0.5F + (float) world.rand.nextGaussian() * 3F,
|
||||
sapY + 0.5F + world.rand.nextFloat() * 4F,
|
||||
sapZ + 0.5F + (float) world.rand.nextGaussian() * 3F,
|
||||
message.posX + 0.5F,
|
||||
message.posY + 0.5F,
|
||||
message.posZ + 0.5F,
|
||||
0.6F, BiomeColors.getFoliageColor(world, new BlockPos(sapX, sapY, sapZ)), 1.5F);
|
||||
if (releaseAura)
|
||||
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.03F,
|
||||
world.rand.nextFloat() * 0.04F + 0.04F,
|
||||
world.rand.nextGaussian() * 0.03F,
|
||||
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 60, 0F, false, true);
|
||||
break;
|
||||
case 13: // Offering table
|
||||
int genX = message.data[0];
|
||||
int genY = message.data[1];
|
||||
int genZ = message.data[2];
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextFloat() * 0.25F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
0xffadfd, 1.5F, 40, 0F, false, true);
|
||||
for (int i = world.rand.nextInt(50) + 30; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
genX + 0.5F + world.rand.nextGaussian() * 2.5F,
|
||||
genY + 0.1F,
|
||||
genZ + 0.5F + world.rand.nextGaussian() * 2.5F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.01F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0xd3e4ff, 1.5F, 150, 0F, false, true);
|
||||
break;
|
||||
case 14: // Pickup stopper
|
||||
break;
|
||||
case 21: // End flower item consuming
|
||||
color = message.data[0];
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.4F, message.posZ,
|
||||
world.rand.nextGaussian() * 0.005F,
|
||||
world.rand.nextFloat() * 0.005F,
|
||||
world.rand.nextGaussian() * 0.005F,
|
||||
0xcc3116, 1.5F, 40, 0F, false, true);
|
||||
break;
|
||||
case 15: // Spawn lamp
|
||||
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.3F + world.rand.nextFloat() * 0.4F,
|
||||
message.posY + 0.15F + world.rand.nextFloat() * 0.5F,
|
||||
message.posZ + 0.3F + world.rand.nextFloat() * 0.4F,
|
||||
0F, 0F, 0F,
|
||||
0xf4a142, 1F, 30, 0F, false, true);
|
||||
break;
|
||||
case 16: // Animal generator aura creation
|
||||
for (int i = world.rand.nextInt(5) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.04F + 0.02F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0xd13308, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
break;
|
||||
case 17: // Animal generator consuming
|
||||
boolean child = message.data[0] > 0;
|
||||
float height = message.data[1] / 10F;
|
||||
genX = message.data[2];
|
||||
genY = message.data[3];
|
||||
genZ = message.data[4];
|
||||
for (int i = (child ? world.rand.nextInt(10) + 10 : world.rand.nextInt(20) + 20); i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextGaussian() * 0.25F,
|
||||
message.posY + height * 0.75F + world.rand.nextGaussian() * 0.25F,
|
||||
message.posZ + world.rand.nextGaussian() * 0.25F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.01F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0x42f4c8, world.rand.nextFloat() * (child ? 0.5F : 2F) + 1F, world.rand.nextInt(30) + 40, 0F, true, true);
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.01F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
color, 1.5F, 40, 0F, false, true);
|
||||
break;
|
||||
case 22: // Mover cart
|
||||
float motionX = message.data[0] / 100F;
|
||||
float motionY = message.data[1] / 100F;
|
||||
float motionZ = message.data[2] / 100F;
|
||||
for (int i = world.rand.nextInt(60) + 30; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextGaussian() * 10F,
|
||||
message.posY + world.rand.nextGaussian() * 10F,
|
||||
message.posZ + world.rand.nextGaussian() * 10F,
|
||||
motionX * 0.2F, motionY * 0.2F, motionZ * 0.2F,
|
||||
IAuraType.forWorld(world).getColor(), 2F, 30, 0F, false, true);
|
||||
break;
|
||||
case 23: // Moss generator
|
||||
for (int i = world.rand.nextInt(30) + 30; i >= 0; i--) {
|
||||
int side = world.rand.nextInt(3);
|
||||
float x = side != 0 ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
||||
float y = side != 1 ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
||||
float z = side != 2 ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + x,
|
||||
message.posY + y,
|
||||
message.posZ + z,
|
||||
0F, 0F, 0F,
|
||||
0x184c0d, world.rand.nextFloat() + 1F, 30, 0F, true, true);
|
||||
}
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat(),
|
||||
message.posY + 1F,
|
||||
message.posZ + world.rand.nextFloat(),
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.04F + 0.02F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, true, true);
|
||||
break;
|
||||
case 24: // Firework generator
|
||||
int goalX = message.data[0];
|
||||
int goalY = message.data[1];
|
||||
int goalZ = message.data[2];
|
||||
NaturesAuraAPI.instance().setParticleSpawnRange(64);
|
||||
for (int i = world.rand.nextInt(30) + 30; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
message.posX, message.posY + height * 0.75F, message.posZ,
|
||||
genX + 0.5F, genY + 0.5F, genZ + 0.5F,
|
||||
0.15F, 0x41c4f4, child ? 1.5F : 3F);
|
||||
break;
|
||||
case 18: // End flower decay
|
||||
color = message.data[0];
|
||||
for (int i = world.rand.nextInt(10) + 20; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat(),
|
||||
message.posY + world.rand.nextFloat(),
|
||||
message.posZ + world.rand.nextFloat(),
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.01F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
color, 1.5F, 80, 0F, true, true);
|
||||
break;
|
||||
case 19: // Animal spawner, auto crafter
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
world.rand.nextFloat() * 0.02F,
|
||||
world.rand.nextGaussian() * 0.02F,
|
||||
0x16b7b2, 1.5F, 40, 0F, false, true);
|
||||
break;
|
||||
case 20: // RF converter
|
||||
for (int i = world.rand.nextInt(5) + 2; i >= 0; i--)
|
||||
Multiblocks.RF_CONVERTER.forEach(new BlockPos(message.posX, message.posY, message.posZ), 'R', (blockPos, matcher) -> {
|
||||
if (world.rand.nextFloat() < 0.35F) {
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
blockPos.getX() + world.rand.nextFloat(),
|
||||
blockPos.getY() + world.rand.nextFloat(),
|
||||
blockPos.getZ() + world.rand.nextFloat(),
|
||||
message.posX + world.rand.nextFloat(),
|
||||
message.posY + world.rand.nextFloat(),
|
||||
message.posZ + world.rand.nextFloat(),
|
||||
0.05F, 0xff1a05, 1.5F);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
break;
|
||||
case 21: // End flower item consuming
|
||||
color = message.data[0];
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.01F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
color, 1.5F, 40, 0F, false, true);
|
||||
break;
|
||||
case 22: // Mover cart
|
||||
float motionX = message.data[0] / 100F;
|
||||
float motionY = message.data[1] / 100F;
|
||||
float motionZ = message.data[2] / 100F;
|
||||
for (int i = world.rand.nextInt(60) + 30; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextGaussian() * 10F,
|
||||
message.posY + world.rand.nextGaussian() * 10F,
|
||||
message.posZ + world.rand.nextGaussian() * 10F,
|
||||
motionX * 0.2F, motionY * 0.2F, motionZ * 0.2F,
|
||||
IAuraType.forWorld(world).getColor(), 2F, 30, 0F, false, true);
|
||||
break;
|
||||
case 23: // Moss generator
|
||||
for (int i = world.rand.nextInt(30) + 30; i >= 0; i--) {
|
||||
int side = world.rand.nextInt(3);
|
||||
float x = side != 0 ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
||||
float y = side != 1 ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
||||
float z = side != 2 ? world.rand.nextFloat() : (world.rand.nextBoolean() ? 1.1F : -0.1F);
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + x,
|
||||
message.posY + y,
|
||||
message.posZ + z,
|
||||
0F, 0F, 0F,
|
||||
0x184c0d, world.rand.nextFloat() + 1F, 30, 0F, true, true);
|
||||
}
|
||||
for (int i = world.rand.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat(),
|
||||
message.posY + 1F,
|
||||
message.posZ + world.rand.nextFloat(),
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.04F + 0.02F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, true, true);
|
||||
break;
|
||||
case 24: // Firework generator
|
||||
int goalX = message.data[0];
|
||||
int goalY = message.data[1];
|
||||
int goalZ = message.data[2];
|
||||
NaturesAuraAPI.instance().setParticleSpawnRange(64);
|
||||
for (int i = world.rand.nextInt(30) + 30; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
message.posX + (float) world.rand.nextGaussian(),
|
||||
message.posY + (float) world.rand.nextGaussian(),
|
||||
message.posZ + (float) world.rand.nextGaussian(),
|
||||
goalX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
goalY + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
goalZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
0.65F, message.data[3 + world.rand.nextInt(message.data.length - 3)], 1F);
|
||||
NaturesAuraAPI.instance().setParticleSpawnRange(32);
|
||||
break;
|
||||
case 25: // Dimension rail
|
||||
float width = message.data[0] / 100F;
|
||||
height = message.data[1] / 100F;
|
||||
float depth = message.data[2] / 100F;
|
||||
for (int i = world.rand.nextInt(100) + 50; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat() * width,
|
||||
message.posY + world.rand.nextFloat() * height,
|
||||
message.posZ + world.rand.nextFloat() * depth,
|
||||
0F, 0F, 0F, 0xd60cff, 1F + world.rand.nextFloat(), 60, 0F, false, true);
|
||||
break;
|
||||
case 26: // Projectile generator
|
||||
int x = message.data[0];
|
||||
int y = message.data[1];
|
||||
int z = message.data[2];
|
||||
for (int i = world.rand.nextInt(10) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
x + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
y + 1.01F,
|
||||
z + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.04F + 0.02F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
|
||||
world.addParticle(ParticleTypes.FIREWORK,
|
||||
message.posX, message.posY, message.posZ,
|
||||
world.rand.nextGaussian() * 0.03F,
|
||||
world.rand.nextGaussian() * 0.03F,
|
||||
world.rand.nextGaussian() * 0.03F);
|
||||
}
|
||||
message.posX + (float) world.rand.nextGaussian(),
|
||||
message.posY + (float) world.rand.nextGaussian(),
|
||||
message.posZ + (float) world.rand.nextGaussian(),
|
||||
goalX + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
goalY + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
goalZ + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
0.65F, message.data[3 + world.rand.nextInt(message.data.length - 3)], 1F);
|
||||
NaturesAuraAPI.instance().setParticleSpawnRange(32);
|
||||
break;
|
||||
case 25: // Dimension rail
|
||||
float width = message.data[0] / 100F;
|
||||
height = message.data[1] / 100F;
|
||||
float depth = message.data[2] / 100F;
|
||||
for (int i = world.rand.nextInt(100) + 50; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + world.rand.nextFloat() * width,
|
||||
message.posY + world.rand.nextFloat() * height,
|
||||
message.posZ + world.rand.nextFloat() * depth,
|
||||
0F, 0F, 0F, 0xd60cff, 1F + world.rand.nextFloat(), 60, 0F, false, true);
|
||||
break;
|
||||
case 26: // Projectile generator
|
||||
int x = message.data[0];
|
||||
int y = message.data[1];
|
||||
int z = message.data[2];
|
||||
for (int i = world.rand.nextInt(10) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
x + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
y + 1.01F,
|
||||
z + 0.25F + world.rand.nextFloat() * 0.5F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
world.rand.nextFloat() * 0.04F + 0.02F,
|
||||
world.rand.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + world.rand.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
|
||||
world.addParticle(ParticleTypes.FIREWORK,
|
||||
message.posX, message.posY, message.posZ,
|
||||
world.rand.nextGaussian() * 0.03F,
|
||||
world.rand.nextGaussian() * 0.03F,
|
||||
world.rand.nextGaussian() * 0.03F);
|
||||
}
|
||||
});
|
||||
ctx.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
ctx.get().setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue