mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-25 04:58:33 +01:00
some work on the port
This commit is contained in:
parent
0d638e9e1e
commit
6525ff5d25
19 changed files with 553 additions and 629 deletions
|
@ -21,7 +21,7 @@ import net.minecraft.server.level.ServerPlayer;
|
|||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.entity.decoration.ItemFrame;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -37,7 +37,7 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
|
@ -46,8 +46,6 @@ import net.neoforged.neoforge.capabilities.Capabilities;
|
|||
import net.neoforged.neoforge.capabilities.ICapabilityProvider;
|
||||
import net.neoforged.neoforge.items.IItemHandler;
|
||||
import net.neoforged.neoforge.items.IItemHandlerModifiable;
|
||||
import top.theillusivec4.curios.api.CuriosApi;
|
||||
import top.theillusivec4.curios.api.SlotResult;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.List;
|
||||
|
@ -116,7 +114,7 @@ public final class Helper {
|
|||
}
|
||||
|
||||
public static boolean areItemsEqual(ItemStack first, ItemStack second, boolean nbt) {
|
||||
return nbt ? ItemStack.isSameItemSameTags(first, second) : ItemStack.isSameItem(first, second);
|
||||
return nbt ? ItemStack.isSameItemSameComponents(first, second) : ItemStack.isSameItem(first, second);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
@ -132,34 +130,34 @@ public final class Helper {
|
|||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderWeirdBox(VertexConsumer buffer, double x, double y, double z, double width, double height, double depth, float r, float g, float b, float a) {
|
||||
buffer.vertex(x, y + height, z).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y + height, z).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y, z).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x, y, z).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y, z).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y + height, z).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y + height, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y + height, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x, y + height, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x, y, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x, y + height, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x, y + height, z).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x, y, z).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x, y, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x, y + height, z).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x, y + height, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y + height, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y + height, z).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y, z).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x + width, y, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x, y, z + depth).color(r, g, b, a).endVertex();
|
||||
buffer.vertex(x, y, z).color(r, g, b, a).endVertex();
|
||||
public static void renderWeirdBox(VertexConsumer buffer, float x, float y, float z, float width, float height, float depth, float r, float g, float b, float a) {
|
||||
buffer.addVertex(x, y + height, z).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y + height, z).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y, z).setColor(r, g, b, a);
|
||||
buffer.addVertex(x, y, z).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y, z).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y + height, z).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y + height, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y + height, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x, y + height, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x, y, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x, y + height, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x, y + height, z).setColor(r, g, b, a);
|
||||
buffer.addVertex(x, y, z).setColor(r, g, b, a);
|
||||
buffer.addVertex(x, y, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x, y + height, z).setColor(r, g, b, a);
|
||||
buffer.addVertex(x, y + height, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y + height, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y + height, z).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y, z).setColor(r, g, b, a);
|
||||
buffer.addVertex(x + width, y, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x, y, z + depth).setColor(r, g, b, a);
|
||||
buffer.addVertex(x, y, z).setColor(r, g, b, a);
|
||||
}
|
||||
|
||||
public static InteractionResult putStackOnTile(Player player, InteractionHand hand, BlockPos pos, int slot, boolean sound) {
|
||||
public static ItemInteractionResult putStackOnTile(Player player, InteractionHand hand, BlockPos pos, int slot, boolean sound) {
|
||||
var tile = player.level().getBlockEntity(pos);
|
||||
if (tile instanceof BlockEntityImpl) {
|
||||
var handler = (IItemHandlerModifiable) tile.getLevel().getCapability(Capabilities.ItemHandler.BLOCK, tile.getBlockPos(), tile.getBlockState(), tile, null);
|
||||
|
@ -170,17 +168,17 @@ public final class Helper {
|
|||
if (!ItemStack.matches(remain, handStack)) {
|
||||
if (sound)
|
||||
player.level().playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
||||
SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.PLAYERS, 0.75F, 1F);
|
||||
SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.PLAYERS, 0.75F, 1F);
|
||||
if (!player.level().isClientSide)
|
||||
player.setItemInHand(hand, remain);
|
||||
return InteractionResult.SUCCESS;
|
||||
return ItemInteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
if (!handler.getStackInSlot(slot).isEmpty()) {
|
||||
if (sound)
|
||||
player.level().playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
||||
SoundEvents.ITEM_FRAME_REMOVE_ITEM, SoundSource.PLAYERS, 0.75F, 1F);
|
||||
SoundEvents.ITEM_FRAME_REMOVE_ITEM, SoundSource.PLAYERS, 0.75F, 1F);
|
||||
if (!player.level().isClientSide) {
|
||||
var stack = handler.getStackInSlot(slot);
|
||||
if (!player.addItem(stack)) {
|
||||
|
@ -189,11 +187,11 @@ public final class Helper {
|
|||
}
|
||||
handler.setStackInSlot(slot, ItemStack.EMPTY);
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
return ItemInteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
return InteractionResult.CONSUME;
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
}
|
||||
|
||||
public static ICapabilityProvider<ItemStack, Void, IAuraRecharge> makeRechargeProvider(boolean needsSelected) {
|
||||
|
@ -215,7 +213,7 @@ public final class Helper {
|
|||
|
||||
public static BlockState getStateFromString(String raw) {
|
||||
var split = raw.split("\\[");
|
||||
var block = BuiltInRegistries.BLOCK.get(new ResourceLocation(split[0]));
|
||||
var block = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(split[0]));
|
||||
if (block != null) {
|
||||
var state = block.defaultBlockState();
|
||||
if (split.length > 1) {
|
||||
|
@ -284,7 +282,7 @@ public final class Helper {
|
|||
for (var entry : clazz.getFields()) {
|
||||
if (!Modifier.isStatic(entry.getModifiers()))
|
||||
continue;
|
||||
var location = new ResourceLocation(NaturesAura.MOD_ID, entry.getName().toLowerCase(Locale.ROOT));
|
||||
var location = ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, entry.getName().toLowerCase(Locale.ROOT));
|
||||
if (!registry.containsKey(location)) {
|
||||
NaturesAura.LOGGER.fatal("Couldn't find entry named " + location + " in registry");
|
||||
continue;
|
||||
|
@ -298,14 +296,15 @@ public final class Helper {
|
|||
}
|
||||
|
||||
public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player, boolean hotbarOnly) {
|
||||
if (Compat.hasCompat("curios")) {
|
||||
// TODO curios?
|
||||
/* if (Compat.hasCompat("curios")) {
|
||||
var inventory = CuriosApi.getCuriosInventory(player);
|
||||
if (inventory.isPresent()) {
|
||||
var stack = inventory.get().findFirstCurio(predicate).map(SlotResult::stack);
|
||||
if (stack.isPresent())
|
||||
return stack.get();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
var invSize = hotbarOnly ? 9 : player.getInventory().getContainerSize();
|
||||
for (var i = 0; i < invSize; i++) {
|
||||
var slot = player.getInventory().getItem(i);
|
||||
|
|
|
@ -52,10 +52,10 @@ public final class NaturesAuraAPI {
|
|||
* A map of all {@link IAuraType} instances which are types of Aura present in different types of levels. {@link BasicAuraType} instances can be easily registered using {@link BasicAuraType#register()}.
|
||||
*/
|
||||
public static final Map<ResourceLocation, IAuraType> AURA_TYPES = new HashMap<>();
|
||||
public static final BasicAuraType TYPE_OVERWORLD = new BasicAuraType(new ResourceLocation(NaturesAuraAPI.MOD_ID, "overworld"), Level.OVERWORLD, 0x89cc37, 0).register();
|
||||
public static final BasicAuraType TYPE_NETHER = new BasicAuraType(new ResourceLocation(NaturesAuraAPI.MOD_ID, "nether"), Level.NETHER, 0x871c0c, 0).register();
|
||||
public static final BasicAuraType TYPE_END = new BasicAuraType(new ResourceLocation(NaturesAuraAPI.MOD_ID, "end"), Level.END, 0x302624, 0).register();
|
||||
public static final BasicAuraType TYPE_OTHER = new BasicAuraType(new ResourceLocation(NaturesAuraAPI.MOD_ID, "other"), null, 0x2fa8a0, Integer.MIN_VALUE).register();
|
||||
public static final BasicAuraType TYPE_OVERWORLD = new BasicAuraType(ResourceLocation.fromNamespaceAndPath(NaturesAuraAPI.MOD_ID, "overworld"), Level.OVERWORLD, 0x89cc37, 0).register();
|
||||
public static final BasicAuraType TYPE_NETHER = new BasicAuraType(ResourceLocation.fromNamespaceAndPath(NaturesAuraAPI.MOD_ID, "nether"), Level.NETHER, 0x871c0c, 0).register();
|
||||
public static final BasicAuraType TYPE_END = new BasicAuraType(ResourceLocation.fromNamespaceAndPath(NaturesAuraAPI.MOD_ID, "end"), Level.END, 0x302624, 0).register();
|
||||
public static final BasicAuraType TYPE_OTHER = new BasicAuraType(ResourceLocation.fromNamespaceAndPath(NaturesAuraAPI.MOD_ID, "other"), null, 0x2fa8a0, Integer.MIN_VALUE).register();
|
||||
/**
|
||||
* A map of all {@link IDrainSpotEffect} suppliers which are effects that happen passively at every spot that Aura has been drained from in the level. These effects include things like vegetational increase and natural decay. To register your own drain spot effects, just add a supplier for them to this map, and they will automatically be executed once a second for every drain spot currently loaded.
|
||||
*/
|
||||
|
@ -87,15 +87,15 @@ public final class NaturesAuraAPI {
|
|||
/**
|
||||
* The capability for any item that stores Aura in the form of an {@link IAuraContainer}
|
||||
*/
|
||||
public static final ItemCapability<IAuraContainer, Void> AURA_CONTAINER_ITEM_CAPABILITY = ItemCapability.createVoid(new ResourceLocation(NaturesAuraAPI.MOD_ID, "aura_container_item"), IAuraContainer.class);
|
||||
public static final ItemCapability<IAuraContainer, Void> AURA_CONTAINER_ITEM_CAPABILITY = ItemCapability.createVoid(ResourceLocation.fromNamespaceAndPath(NaturesAuraAPI.MOD_ID, "aura_container_item"), IAuraContainer.class);
|
||||
/**
|
||||
* The capability for any block that stores Aura in the form of an {@link IAuraContainer}
|
||||
*/
|
||||
public static final BlockCapability<IAuraContainer, Direction> AURA_CONTAINER_BLOCK_CAPABILITY = BlockCapability.create(new ResourceLocation(NaturesAuraAPI.MOD_ID, "aura_container_block"), IAuraContainer.class, Direction.class);
|
||||
public static final BlockCapability<IAuraContainer, Direction> AURA_CONTAINER_BLOCK_CAPABILITY = BlockCapability.create(ResourceLocation.fromNamespaceAndPath(NaturesAuraAPI.MOD_ID, "aura_container_block"), IAuraContainer.class, Direction.class);
|
||||
/**
|
||||
* The capability for any item that can be recharged from an Aura storage container like the Aura Cache in the form of {@link IAuraRecharge} by a player holding it in their hand
|
||||
*/
|
||||
public static final ItemCapability<IAuraRecharge, Void> AURA_RECHARGE_CAPABILITY = ItemCapability.createVoid(new ResourceLocation(NaturesAuraAPI.MOD_ID, "aura_recharge"), IAuraRecharge.class);
|
||||
public static final ItemCapability<IAuraRecharge, Void> AURA_RECHARGE_CAPABILITY = ItemCapability.createVoid(ResourceLocation.fromNamespaceAndPath(NaturesAuraAPI.MOD_ID, "aura_recharge"), IAuraRecharge.class);
|
||||
/**
|
||||
* The capability that any chunk in a level has to store Aura in it. As this is only applicable to chunks and all chunks in the level automatically get assigned this capability, using it directly is not necessary for addon developers. To retrieve this capability from any chunk, use the helper method {@link IAuraChunk#getAuraChunk(net.minecraft.world.level.Level, BlockPos)}.
|
||||
*/
|
||||
|
|
|
@ -20,9 +20,11 @@ import net.minecraft.sounds.SoundEvents;
|
|||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.BaseRailBlock;
|
||||
|
@ -35,10 +37,8 @@ import net.minecraft.world.level.block.state.properties.EnumProperty;
|
|||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import net.minecraft.world.level.block.state.properties.RailShape;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.portal.DimensionTransition;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.neoforged.neoforge.common.util.ITeleporter;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BlockDimensionRail extends BaseRailBlock implements IModItem, ICustomBlockState, ICustomItemModel {
|
||||
|
||||
|
@ -66,20 +66,18 @@ public class BlockDimensionRail extends BaseRailBlock implements IModItem, ICust
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
var stack = player.getItemInHand(hand);
|
||||
protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
|
||||
if (stack.getItem() == ModItems.RANGE_VISUALIZER) {
|
||||
if (!levelIn.isClientSide) {
|
||||
var goalPos = this.getGoalCoords(levelIn, pos);
|
||||
if (!level.isClientSide) {
|
||||
var goalPos = this.getGoalCoords(level, pos);
|
||||
var data = new CompoundTag();
|
||||
data.putString("dim", this.goalDim.location().toString());
|
||||
data.putLong("pos", goalPos.asLong());
|
||||
PacketHandler.sendTo(player, new PacketClient(0, data));
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
return ItemInteractionResult.SUCCESS;
|
||||
}
|
||||
return InteractionResult.FAIL;
|
||||
return ItemInteractionResult.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,21 +93,9 @@ public class BlockDimensionRail extends BaseRailBlock implements IModItem, ICust
|
|||
PacketHandler.sendToAllAround(level, pos, 32, new PacketParticles((float) box.minX, (float) box.minY, (float) box.minZ, PacketParticles.Type.DIMENSION_RAIL, (int) ((box.maxX - box.minX) * 100F), (int) ((box.maxY - box.minY) * 100F), (int) ((box.maxZ - box.minZ) * 100F)));
|
||||
level.playSound(null, pos, SoundEvents.ENDERMAN_TELEPORT, SoundSource.BLOCKS, 1F, 1F);
|
||||
|
||||
var goalCoords = this.getGoalCoords(level, pos);
|
||||
cart.changeDimension(level.getServer().getLevel(this.goalDim), new ITeleporter() {
|
||||
@Override
|
||||
public Entity placeEntity(Entity entity, ServerLevel currentLevel, ServerLevel destLevel, float yaw, Function<Boolean, Entity> repositionEntity) {
|
||||
// repositionEntity always causes a NPE because why wouldn't it, so this is a fixed copy
|
||||
entity.level().getProfiler().popPush("reloading");
|
||||
var result = entity.getType().create(destLevel);
|
||||
if (result != null) {
|
||||
result.restoreFrom(entity);
|
||||
destLevel.addDuringTeleport(result);
|
||||
result.moveTo(goalCoords, yaw, result.getXRot());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
});
|
||||
// TODO test if this new dimension change works!
|
||||
var goalCoords = this.getGoalCoords(level, pos).getCenter();
|
||||
cart.changeDimension(new DimensionTransition(level.getServer().getLevel(this.goalDim), goalCoords, cart.getDeltaMovement(), cart.getYRot(), cart.getXRot(), DimensionTransition.PLAY_PORTAL_SOUND));
|
||||
|
||||
var spot = IAuraChunk.getHighestSpot(level, pos, 35, pos);
|
||||
IAuraChunk.getAuraChunk(level, spot).drainAura(spot, 50000);
|
||||
|
@ -177,4 +163,5 @@ public class BlockDimensionRail extends BaseRailBlock implements IModItem, ICust
|
|||
public void generateCustomItemModel(ItemModelGenerator generator) {
|
||||
generator.withExistingParent(this.getBaseName(), "item/generated").texture("layer0", "block/" + this.getBaseName());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.event.entity.living.LivingEvent;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.neoforge.event.tick.EntityTickEvent;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
@ -52,7 +53,7 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDragonTick(LivingEvent.LivingTickEvent event) {
|
||||
public void onDragonTick(EntityTickEvent.Pre event) {
|
||||
var living = event.getEntity();
|
||||
if (living.level().isClientSide || !(living instanceof EnderDragon dragon))
|
||||
return;
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.world.phys.AABB;
|
|||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.event.level.SaplingGrowTreeEvent;
|
||||
import net.neoforged.neoforge.event.level.BlockGrowFeatureEvent;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
|
||||
public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||
|
@ -31,11 +31,11 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTreeGrow(SaplingGrowTreeEvent event) {
|
||||
public void onTreeGrow(BlockGrowFeatureEvent event) {
|
||||
var level = event.getLevel();
|
||||
var pos = event.getPos();
|
||||
if (level instanceof Level && !level.isClientSide() && IAuraType.forLevel((Level) level).isSimilar(NaturesAuraAPI.TYPE_OVERWORLD)
|
||||
&& level.getBlockState(pos).getBlock() instanceof SaplingBlock) {
|
||||
&& level.getBlockState(pos).getBlock() instanceof SaplingBlock) {
|
||||
Helper.getBlockEntitiesInArea(level, pos, 10, tile -> {
|
||||
if (!(tile instanceof BlockEntityOakGenerator oak))
|
||||
return false;
|
||||
|
@ -64,13 +64,13 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
|
|||
@Override
|
||||
public void generateCustomBlockState(BlockStateGenerator generator) {
|
||||
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
|
||||
generator.modLoc("block/" + this.getBaseName()),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_bottom"),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top")));
|
||||
generator.modLoc("block/" + this.getBaseName()),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_bottom"),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top")));
|
||||
}
|
||||
|
||||
private static ResourceKey<ConfiguredFeature<?, ?>> getReplacement(Holder<ConfiguredFeature<?, ?>> holder) {
|
||||
if(holder == null || !holder.unwrapKey().isPresent())
|
||||
if (holder == null || !holder.unwrapKey().isPresent())
|
||||
return null;
|
||||
|
||||
ResourceKey<ConfiguredFeature<?, ?>> feature = holder.unwrapKey().get();
|
||||
|
@ -86,4 +86,5 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,8 +14,9 @@ import net.minecraft.world.phys.AABB;
|
|||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.neoforge.common.util.TriState;
|
||||
import net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent;
|
||||
|
||||
public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
|
||||
|
||||
|
@ -26,10 +27,10 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPickup(EntityItemPickupEvent event) {
|
||||
var player = event.getEntity();
|
||||
public void onPickup(ItemEntityPickupEvent.Pre event) {
|
||||
var player = event.getPlayer();
|
||||
if (player != null && !player.isShiftKeyDown()) {
|
||||
var item = event.getItem();
|
||||
var item = event.getItemEntity();
|
||||
var pos = item.blockPosition();
|
||||
Helper.getBlockEntitiesInArea(item.level(), pos, 8, tile -> {
|
||||
if (!(tile instanceof BlockEntityPickupStopper stopper))
|
||||
|
@ -41,11 +42,11 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
|
|||
if (!new AABB(stopperPos).inflate(radius).intersects(item.getBoundingBox()))
|
||||
return false;
|
||||
|
||||
event.setCanceled(true);
|
||||
event.setCanPickup(TriState.FALSE);
|
||||
|
||||
if (item.level().getGameTime() % 3 == 0)
|
||||
PacketHandler.sendToAllAround(item.level(), pos, 32,
|
||||
new PacketParticles((float) item.getX(), (float) item.getY(), (float) item.getZ(), PacketParticles.Type.PICKUP_STOPPER));
|
||||
new PacketParticles((float) item.getX(), (float) item.getY(), (float) item.getZ(), PacketParticles.Type.PICKUP_STOPPER));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -72,8 +73,9 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
|
|||
@Override
|
||||
public void generateCustomBlockState(BlockStateGenerator generator) {
|
||||
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
|
||||
generator.modLoc("block/" + this.getBaseName()),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top"),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top")));
|
||||
generator.modLoc("block/" + this.getBaseName()),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top"),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top")));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,25 +10,25 @@ import de.ellpeck.naturesaura.packet.PacketParticles;
|
|||
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
||||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||
import net.minecraft.core.Position;
|
||||
import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior;
|
||||
import net.minecraft.core.dispenser.BlockSource;
|
||||
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.entity.projectile.ThrownEnderpearl;
|
||||
import net.minecraft.world.entity.projectile.ThrownTrident;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.ProjectileItem.DispenseConfig;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.DispenserBlock;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.event.entity.ProjectileImpactEvent;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.util.ObfuscationReflectionHelper;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.event.entity.ProjectileImpactEvent;
|
||||
|
||||
public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider<BlockEntityProjectileGenerator>, ICustomBlockState {
|
||||
|
||||
|
@ -36,23 +36,34 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
|
|||
super("projectile_generator", BlockEntityProjectileGenerator.class, Properties.of().strength(2.5F).sound(SoundType.STONE));
|
||||
|
||||
NeoForge.EVENT_BUS.register(this);
|
||||
DispenserBlock.registerBehavior(Items.ENDER_PEARL, new AbstractProjectileDispenseBehavior() {
|
||||
|
||||
DispenserBlock.registerBehavior(Items.ENDER_PEARL, new DefaultDispenseItemBehavior() {
|
||||
@Override
|
||||
protected Projectile getProjectile(Level levelIn, Position position, ItemStack stackIn) {
|
||||
var ret = new ThrownEnderpearl(EntityType.ENDER_PEARL, levelIn);
|
||||
ret.setPos(position.x(), position.y(), position.z());
|
||||
return ret;
|
||||
protected ItemStack execute(BlockSource blockSource, ItemStack item) {
|
||||
Level level = blockSource.level();
|
||||
var direction = blockSource.state().getValue(DispenserBlock.FACING);
|
||||
var position = DispenseConfig.DEFAULT.positionFunction().getDispensePosition(blockSource, direction);
|
||||
var projectile = new ThrownEnderpearl(EntityType.ENDER_PEARL, level);
|
||||
projectile.setPos(position.x(), position.y(), position.z());
|
||||
projectile.shoot(direction.getStepX(), direction.getStepY(), direction.getStepZ(), DispenseConfig.DEFAULT.power(), DispenseConfig.DEFAULT.uncertainty());
|
||||
level.addFreshEntity(projectile);
|
||||
item.shrink(1);
|
||||
return item;
|
||||
}
|
||||
});
|
||||
DispenserBlock.registerBehavior(Items.TRIDENT, new AbstractProjectileDispenseBehavior() {
|
||||
DispenserBlock.registerBehavior(Items.TRIDENT, new DefaultDispenseItemBehavior() {
|
||||
@Override
|
||||
protected Projectile getProjectile(Level levelIn, Position position, ItemStack stackIn) {
|
||||
var ret = new ThrownTrident(EntityType.TRIDENT, levelIn);
|
||||
ret.setPos(position.x(), position.y(), position.z());
|
||||
ObfuscationReflectionHelper.setPrivateValue(ThrownTrident.class, ret, stackIn.copy(), "pickupItemStack");
|
||||
ret.pickup = AbstractArrow.Pickup.ALLOWED;
|
||||
return ret;
|
||||
protected ItemStack execute(BlockSource blockSource, ItemStack item) {
|
||||
Level level = blockSource.level();
|
||||
var direction = blockSource.state().getValue(DispenserBlock.FACING);
|
||||
var position = DispenseConfig.DEFAULT.positionFunction().getDispensePosition(blockSource, direction);
|
||||
var projectile = new ThrownTrident(EntityType.TRIDENT, level);
|
||||
ObfuscationReflectionHelper.setPrivateValue(ThrownTrident.class, projectile, item.copy(), "pickupItemStack");
|
||||
projectile.pickup = AbstractArrow.Pickup.ALLOWED;
|
||||
projectile.setPos(position.x(), position.y(), position.z());
|
||||
projectile.shoot(direction.getStepX(), direction.getStepY(), direction.getStepZ(), DispenseConfig.DEFAULT.power(), DispenseConfig.DEFAULT.uncertainty());
|
||||
level.addFreshEntity(projectile);
|
||||
item.shrink(1);
|
||||
return item;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -81,7 +92,7 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
|
|||
generator.generateAura(amount);
|
||||
|
||||
PacketHandler.sendToAllAround(entity.level(), pos, 32,
|
||||
new PacketParticles((float) entity.getX(), (float) entity.getY(), (float) entity.getZ(), PacketParticles.Type.PROJECTILE_GEN, pos.getX(), pos.getY(), pos.getZ()));
|
||||
new PacketParticles((float) entity.getX(), (float) entity.getY(), (float) entity.getZ(), PacketParticles.Type.PROJECTILE_GEN, pos.getX(), pos.getY(), pos.getZ()));
|
||||
entity.level().playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENDER_EYE_LAUNCH, SoundSource.BLOCKS, 0.8F, 1F);
|
||||
|
||||
generator.nextSide = generator.nextSide.getClockWise();
|
||||
|
@ -94,13 +105,14 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
|
|||
@Override
|
||||
public void generateCustomBlockState(BlockStateGenerator generator) {
|
||||
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
|
||||
generator.modLoc("block/" + this.getBaseName()),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top"),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top")));
|
||||
generator.modLoc("block/" + this.getBaseName()),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top"),
|
||||
generator.modLoc("block/" + this.getBaseName() + "_top")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTESR() {
|
||||
BlockEntityRenderers.register(ModBlockEntities.PROJECTILE_GENERATOR, RenderProjectileGenerator::new);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import de.ellpeck.naturesaura.reg.ITESRProvider;
|
|||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.ItemInteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
|
@ -26,7 +26,7 @@ import net.minecraft.world.phys.shapes.Shapes;
|
|||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.event.level.SaplingGrowTreeEvent;
|
||||
import net.neoforged.neoforge.event.level.BlockGrowFeatureEvent;
|
||||
import org.apache.commons.lang3.mutable.MutableObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -53,7 +53,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTreeGrow(SaplingGrowTreeEvent event) {
|
||||
public void onTreeGrow(BlockGrowFeatureEvent event) {
|
||||
var level = event.getLevel();
|
||||
var pos = event.getPos();
|
||||
if (!level.isClientSide() && level instanceof Level) {
|
||||
|
@ -99,9 +99,8 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider<
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
|
||||
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
||||
protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
|
||||
return Helper.putStackOnTile(player, hand, pos, 0, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles;
|
||||
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.AreaEffectCloud;
|
||||
import net.minecraft.world.item.alchemy.PotionUtils;
|
||||
import net.minecraft.world.item.alchemy.PotionContents;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.neoforged.fml.util.ObfuscationReflectionHelper;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class BlockEntityPotionGenerator extends BlockEntityImpl implements ITickableBlockEntity {
|
||||
|
||||
private static final Field POTION_CONTENTS_FIELD = ObfuscationReflectionHelper.findField(AreaEffectCloud.class, "potionContents");
|
||||
|
||||
public BlockEntityPotionGenerator(BlockPos pos, BlockState state) {
|
||||
super(ModBlockEntities.POTION_GENERATOR, pos, state);
|
||||
}
|
||||
|
@ -27,12 +33,17 @@ public class BlockEntityPotionGenerator extends BlockEntityImpl implements ITick
|
|||
continue;
|
||||
|
||||
if (!addedOne) {
|
||||
var type = cloud.getPotion();
|
||||
if (type == null)
|
||||
PotionContents type;
|
||||
try {
|
||||
// TODO check if this new private value getter works
|
||||
type = (PotionContents) BlockEntityPotionGenerator.POTION_CONTENTS_FIELD.get(cloud);
|
||||
} catch (IllegalAccessException e) {
|
||||
NaturesAura.LOGGER.fatal("Couldn't reflect furnace field", e);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var effect : type.getEffects()) {
|
||||
var potion = effect.getEffect();
|
||||
for (var effect : type.getAllEffects()) {
|
||||
var potion = effect.getEffect().value();
|
||||
if (!potion.isBeneficial() || potion.isInstantenous()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -43,8 +54,8 @@ public class BlockEntityPotionGenerator extends BlockEntityImpl implements ITick
|
|||
this.generateAura(toAdd);
|
||||
|
||||
PacketHandler.sendToAllAround(this.level, this.worldPosition, 32, new PacketParticles(
|
||||
this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ(), PacketParticles.Type.POTION_GEN,
|
||||
PotionUtils.getColor(type), canGen ? 1 : 0));
|
||||
this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ(), PacketParticles.Type.POTION_GEN,
|
||||
type.getColor(), canGen ? 1 : 0));
|
||||
|
||||
addedOne = true;
|
||||
break;
|
||||
|
@ -66,4 +77,5 @@ public class BlockEntityPotionGenerator extends BlockEntityImpl implements ITick
|
|||
public boolean wantsLimitRemover() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -132,10 +132,10 @@ public class AuraChunk implements IAuraChunk {
|
|||
this.drainSpots.put(spot.pos, spot);
|
||||
}
|
||||
|
||||
public void setSpots(Collection<DrainSpot> spots) {
|
||||
public void setSpots(Collection<CompoundTag> spots) {
|
||||
this.drainSpots.clear();
|
||||
for (var spot : spots)
|
||||
this.addDrainSpot(spot);
|
||||
this.addDrainSpot(new DrainSpot(spot));
|
||||
this.addOrRemoveAsActive();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// TODO curios?
|
||||
/*
|
||||
package de.ellpeck.naturesaura.compat;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
@ -88,3 +90,4 @@ public class CuriosCompat implements ICompat {
|
|||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@ import de.ellpeck.naturesaura.NaturesAura;
|
|||
import de.ellpeck.naturesaura.gen.ModFeatures;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.worldgen.BootstapContext;
|
||||
import net.minecraft.data.worldgen.BootstrapContext;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BiomeTags;
|
||||
|
@ -23,37 +23,37 @@ public class BiomeModifiers {
|
|||
public static final ResourceKey<BiomeModifier> AURA_MUSHROOM = BiomeModifiers.createKey("aura_mushroom");
|
||||
|
||||
private static ResourceKey<BiomeModifier> createKey(String id) {
|
||||
return ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS, new ResourceLocation(NaturesAura.MOD_ID, id));
|
||||
return ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS, ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, id));
|
||||
}
|
||||
|
||||
public static void bootstrap(BootstapContext<BiomeModifier> context) {
|
||||
public static void bootstrap(BootstrapContext<BiomeModifier> context) {
|
||||
var biomeGetter = context.lookup(Registries.BIOME);
|
||||
var placedGetter = context.lookup(Registries.PLACED_FEATURE);
|
||||
|
||||
context.register(BiomeModifiers.AURA_BLOOM, new AddFeaturesBiomeModifier(
|
||||
biomeGetter.getOrThrow(BiomeTags.IS_OVERWORLD),
|
||||
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_BLOOM)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION));
|
||||
biomeGetter.getOrThrow(BiomeTags.IS_OVERWORLD),
|
||||
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_BLOOM)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION));
|
||||
|
||||
context.register(BiomeModifiers.AURA_CACTUS, new AddFeaturesBiomeModifier(
|
||||
biomeGetter.getOrThrow(Tags.Biomes.IS_SANDY),
|
||||
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_CACTUS)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION));
|
||||
biomeGetter.getOrThrow(Tags.Biomes.IS_SANDY),
|
||||
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_CACTUS)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION));
|
||||
|
||||
context.register(BiomeModifiers.AURA_MUSHROOM, new AddFeaturesBiomeModifier(
|
||||
biomeGetter.getOrThrow(Tags.Biomes.IS_MUSHROOM),
|
||||
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_MUSHROOM)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION));
|
||||
biomeGetter.getOrThrow(Tags.Biomes.IS_MUSHROOM),
|
||||
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_MUSHROOM)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION));
|
||||
|
||||
context.register(BiomeModifiers.CRIMSON_AURA_MUSHROOM, new AddFeaturesBiomeModifier(
|
||||
biomeGetter.getOrThrow(BiomeTags.IS_NETHER),
|
||||
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.CRIMSON_AURA_MUSHROOM)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION));
|
||||
biomeGetter.getOrThrow(BiomeTags.IS_NETHER),
|
||||
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.CRIMSON_AURA_MUSHROOM)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION));
|
||||
|
||||
context.register(BiomeModifiers.WARPED_AURA_MUSHROOM, new AddFeaturesBiomeModifier(
|
||||
biomeGetter.getOrThrow(BiomeTags.IS_NETHER),
|
||||
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.WARPED_AURA_MUSHROOM)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION));
|
||||
biomeGetter.getOrThrow(BiomeTags.IS_NETHER),
|
||||
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.WARPED_AURA_MUSHROOM)),
|
||||
GenerationStep.Decoration.VEGETAL_DECORATION));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.data.loot.LootTableProvider;
|
|||
import net.minecraft.data.registries.VanillaRegistries;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider;
|
||||
import net.neoforged.neoforge.data.event.GatherDataEvent;
|
||||
|
@ -22,7 +23,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD)
|
||||
public final class ModData {
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.neoforged.neoforge.event.entity.living.LivingEvent;
|
|||
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.neoforged.bus.api.EventPriority;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.neoforge.event.tick.EntityTickEvent;
|
||||
|
||||
public class ItemPetReviver extends ItemImpl {
|
||||
|
||||
|
@ -31,7 +32,7 @@ public class ItemPetReviver extends ItemImpl {
|
|||
private static class Events {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityTick(LivingEvent.LivingTickEvent event) {
|
||||
public void onEntityTick(EntityTickEvent event) {
|
||||
var entity = event.getEntity();
|
||||
if (entity.level().isClientSide || entity.level().getGameTime() % 20 != 0 || !(entity instanceof TamableAnimal tameable))
|
||||
return;
|
||||
|
@ -42,10 +43,10 @@ public class ItemPetReviver extends ItemImpl {
|
|||
return;
|
||||
if (entity.level().random.nextFloat() >= 0.65F) {
|
||||
((ServerLevel) entity.level()).sendParticles(ParticleTypes.HEART,
|
||||
entity.getX() + entity.level().random.nextGaussian() * 0.25F,
|
||||
entity.getEyeY() + entity.level().random.nextGaussian() * 0.25F,
|
||||
entity.getZ() + entity.level().random.nextGaussian() * 0.25F,
|
||||
entity.level().random.nextInt(2) + 1, 0, 0, 0, 0);
|
||||
entity.getX() + entity.level().random.nextGaussian() * 0.25F,
|
||||
entity.getEyeY() + entity.level().random.nextGaussian() * 0.25F,
|
||||
entity.getZ() + entity.level().random.nextGaussian() * 0.25F,
|
||||
entity.level().random.nextInt(2) + 1, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,5 +130,7 @@ public class ItemPetReviver extends ItemImpl {
|
|||
owner.sendSystemMessage(Component.translatable("info." + NaturesAura.MOD_ID + ".pet_reviver", spawnedPet.getDisplayName()).withStyle(ChatFormatting.ITALIC, ChatFormatting.GRAY));
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,56 +4,36 @@ import de.ellpeck.naturesaura.NaturesAura;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.chunk.AuraChunk;
|
||||
import de.ellpeck.naturesaura.events.ClientEvents;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.neoforged.neoforge.network.handling.PlayPayloadContext;
|
||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class PacketAuraChunk implements CustomPacketPayload {
|
||||
public record PacketAuraChunk(int chunkX, int chunkZ, Collection<CompoundTag> drainSpots) implements CustomPacketPayload {
|
||||
|
||||
public static final ResourceLocation ID = new ResourceLocation(NaturesAura.MOD_ID, "aura_chunk");
|
||||
|
||||
private final int chunkX;
|
||||
private final int chunkZ;
|
||||
private final Collection<AuraChunk.DrainSpot> drainSpots;
|
||||
|
||||
public PacketAuraChunk(int chunkX, int chunkZ, Collection<AuraChunk.DrainSpot> drainSpots) {
|
||||
this.chunkX = chunkX;
|
||||
this.chunkZ = chunkZ;
|
||||
this.drainSpots = drainSpots;
|
||||
}
|
||||
|
||||
public PacketAuraChunk(FriendlyByteBuf buf) {
|
||||
this.chunkX = buf.readInt();
|
||||
this.chunkZ = buf.readInt();
|
||||
|
||||
this.drainSpots = new ArrayList<>();
|
||||
var amount = buf.readInt();
|
||||
for (var i = 0; i < amount; i++)
|
||||
this.drainSpots.add(new AuraChunk.DrainSpot(buf.readNbt()));
|
||||
}
|
||||
public static final Type<PacketAuraChunk> TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "aura_chunk"));
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, PacketAuraChunk> CODEC = StreamCodec.composite(
|
||||
ByteBufCodecs.INT, PacketAuraChunk::chunkX,
|
||||
ByteBufCodecs.INT, PacketAuraChunk::chunkZ,
|
||||
ByteBufCodecs.collection(ArrayList::new, ByteBufCodecs.COMPOUND_TAG), PacketAuraChunk::drainSpots,
|
||||
PacketAuraChunk::new);
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
buf.writeInt(this.chunkX);
|
||||
buf.writeInt(this.chunkZ);
|
||||
|
||||
buf.writeInt(this.drainSpots.size());
|
||||
for (var entry : this.drainSpots)
|
||||
buf.writeNbt(entry.serializeNBT());
|
||||
public Type<? extends CustomPacketPayload> type() {
|
||||
return PacketAuraChunk.TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation id() {
|
||||
return PacketAuraChunk.ID;
|
||||
}
|
||||
|
||||
public static void onMessage(PacketAuraChunk message, PlayPayloadContext ctx) {
|
||||
ctx.workHandler().execute(() -> ClientEvents.PENDING_AURA_CHUNKS.add(message));
|
||||
public static void onMessage(PacketAuraChunk message, IPayloadContext ctx) {
|
||||
ClientEvents.PENDING_AURA_CHUNKS.add(message);
|
||||
}
|
||||
|
||||
public boolean tryHandle(Level level) {
|
||||
|
@ -62,8 +42,6 @@ public class PacketAuraChunk implements CustomPacketPayload {
|
|||
if (chunk.isEmpty())
|
||||
return false;
|
||||
var auraChunk = (AuraChunk) chunk.getData(NaturesAuraAPI.AURA_CHUNK_ATTACHMENT);
|
||||
if (auraChunk == null)
|
||||
return false;
|
||||
auraChunk.setSpots(this.drainSpots);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -8,63 +8,46 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.neoforged.neoforge.network.handling.PlayPayloadContext;
|
||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||
|
||||
public class PacketClient implements CustomPacketPayload {
|
||||
import java.util.ArrayList;
|
||||
|
||||
public static final ResourceLocation ID = new ResourceLocation(NaturesAura.MOD_ID, "client");
|
||||
public record PacketClient(int packetType, CompoundTag data) implements CustomPacketPayload {
|
||||
|
||||
private final int type;
|
||||
private final CompoundTag data;
|
||||
|
||||
public PacketClient(int type, CompoundTag data) {
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public PacketClient(FriendlyByteBuf buf) {
|
||||
this.type = buf.readByte();
|
||||
this.data = buf.readNbt();
|
||||
}
|
||||
public static final Type<PacketClient> TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "client"));
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, PacketClient> CODEC = StreamCodec.composite(
|
||||
ByteBufCodecs.INT, PacketClient::packetType,
|
||||
ByteBufCodecs.COMPOUND_TAG, PacketClient::data,
|
||||
PacketClient::new);
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
buf.writeByte(this.type);
|
||||
buf.writeNbt(this.data);
|
||||
public Type<? extends CustomPacketPayload> type() {
|
||||
return PacketClient.TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation id() {
|
||||
return PacketClient.ID;
|
||||
}
|
||||
|
||||
@SuppressWarnings("Convert2Lambda")
|
||||
public static void onMessage(PacketClient message, PlayPayloadContext ctx) {
|
||||
ctx.workHandler().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
var mc = Minecraft.getInstance();
|
||||
if (mc.level != null) {
|
||||
switch (message.type) {
|
||||
case 0: // dimension rail visualization
|
||||
var goalDim = new ResourceLocation(message.data.getString("dim"));
|
||||
var goalPos = BlockPos.of(message.data.getLong("pos"));
|
||||
ItemRangeVisualizer.visualize(mc.player, ItemRangeVisualizer.VISUALIZED_RAILS, goalDim, goalPos);
|
||||
case 1:
|
||||
var entity = mc.level.getEntity(message.data.getInt("id"));
|
||||
mc.particleEngine.createTrackingEmitter(entity, ParticleTypes.TOTEM_OF_UNDYING, 30);
|
||||
mc.level.playLocalSound(entity.getX(), entity.getY(), entity.getZ(), SoundEvents.TOTEM_USE, entity.getSoundSource(), 1.0F, 1.0F, false);
|
||||
if (entity == mc.player) {
|
||||
mc.gameRenderer.displayItemActivation(new ItemStack(ModItems.DEATH_RING));
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void onMessage(PacketClient message, IPayloadContext ctx) {
|
||||
var mc = Minecraft.getInstance();
|
||||
if (mc.level != null) {
|
||||
switch (message.packetType) {
|
||||
case 0: // dimension rail visualization
|
||||
var goalDim = ResourceLocation.parse(message.data.getString("dim"));
|
||||
var goalPos = BlockPos.of(message.data.getLong("pos"));
|
||||
ItemRangeVisualizer.visualize(mc.player, ItemRangeVisualizer.VISUALIZED_RAILS, goalDim, goalPos);
|
||||
case 1:
|
||||
var entity = mc.level.getEntity(message.data.getInt("id"));
|
||||
mc.particleEngine.createTrackingEmitter(entity, ParticleTypes.TOTEM_OF_UNDYING, 30);
|
||||
mc.level.playLocalSound(entity.getX(), entity.getY(), entity.getZ(), SoundEvents.TOTEM_USE, entity.getSoundSource(), 1.0F, 1.0F, false);
|
||||
if (entity == mc.player)
|
||||
mc.gameRenderer.displayItemActivation(new ItemStack(ModItems.DEATH_RING));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,33 +3,34 @@ package de.ellpeck.naturesaura.packet;
|
|||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.Mod.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.network.PacketDistributor;
|
||||
import net.neoforged.neoforge.network.event.RegisterPayloadHandlerEvent;
|
||||
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
|
||||
|
||||
@EventBusSubscriber(bus = Bus.MOD)
|
||||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD)
|
||||
public final class PacketHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPayloadRegister(RegisterPayloadHandlerEvent event) {
|
||||
public static void onPayloadRegister(RegisterPayloadHandlersEvent event) {
|
||||
var registrar = event.registrar(NaturesAura.MOD_ID);
|
||||
registrar.play(PacketAuraChunk.ID, PacketAuraChunk::new, PacketAuraChunk::onMessage);
|
||||
registrar.play(PacketClient.ID, PacketClient::new, PacketClient::onMessage);
|
||||
registrar.play(PacketParticles.ID, PacketParticles::new, PacketParticles::onMessage);
|
||||
registrar.play(PacketParticleStream.ID, PacketParticleStream::new, PacketParticleStream::onMessage);
|
||||
registrar.playBidirectional(PacketAuraChunk.TYPE, PacketAuraChunk.CODEC, PacketAuraChunk::onMessage);
|
||||
registrar.playBidirectional(PacketClient.TYPE, PacketClient.CODEC, PacketClient::onMessage);
|
||||
registrar.playBidirectional(PacketParticles.TYPE, PacketParticles.CODEC, PacketParticles::onMessage);
|
||||
registrar.playBidirectional(PacketParticleStream.TYPE, PacketParticleStream.CODEC, PacketParticleStream::onMessage);
|
||||
}
|
||||
|
||||
public static void sendToAllLoaded(Level level, BlockPos pos, CustomPacketPayload message) {
|
||||
PacketDistributor.TRACKING_CHUNK.with(level.getChunkAt(pos)).send(message);
|
||||
PacketDistributor.sendToPlayersTrackingChunk((ServerLevel) level, new ChunkPos(pos), message);
|
||||
}
|
||||
|
||||
public static void sendToAllAround(Level level, BlockPos pos, int range, CustomPacketPayload message) {
|
||||
PacketDistributor.NEAR.with(new PacketDistributor.TargetPoint(pos.getX(), pos.getY(), pos.getZ(), range, level.dimension())).send(message);
|
||||
PacketDistributor.sendToPlayersNear((ServerLevel) level, null, pos.getX(), pos.getY(), pos.getZ(), range, message);
|
||||
}
|
||||
|
||||
public static void sendTo(Player player, CustomPacketPayload message) {
|
||||
|
|
|
@ -2,74 +2,39 @@ package de.ellpeck.naturesaura.packet;
|
|||
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.neoforged.neoforge.network.handling.PlayPayloadContext;
|
||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class PacketParticleStream implements CustomPacketPayload {
|
||||
public record PacketParticleStream(Vector3f start, Vector3f end, float speed, int color, float scale) implements CustomPacketPayload {
|
||||
|
||||
public static final ResourceLocation ID = new ResourceLocation(NaturesAura.MOD_ID, "particle_stream");
|
||||
|
||||
private final float startX;
|
||||
private final float startY;
|
||||
private final float startZ;
|
||||
|
||||
private final float endX;
|
||||
private final float endY;
|
||||
private final float endZ;
|
||||
|
||||
private final float speed;
|
||||
private final int color;
|
||||
private final float scale;
|
||||
public static final Type<PacketParticleStream> TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "particle_stream"));
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, PacketParticleStream> CODEC = StreamCodec.composite(
|
||||
ByteBufCodecs.VECTOR3F, PacketParticleStream::start,
|
||||
ByteBufCodecs.VECTOR3F, PacketParticleStream::end,
|
||||
ByteBufCodecs.FLOAT, PacketParticleStream::speed,
|
||||
ByteBufCodecs.INT, PacketParticleStream::color,
|
||||
ByteBufCodecs.FLOAT, PacketParticleStream::scale,
|
||||
PacketParticleStream::new);
|
||||
|
||||
public PacketParticleStream(float startX, float startY, float startZ, float endX, float endY, float endZ, float speed, int color, float scale) {
|
||||
this.startX = startX;
|
||||
this.startY = startY;
|
||||
this.startZ = startZ;
|
||||
this.endX = endX;
|
||||
this.endY = endY;
|
||||
this.endZ = endZ;
|
||||
this.speed = speed;
|
||||
this.color = color;
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public PacketParticleStream(FriendlyByteBuf buf) {
|
||||
this.startX = buf.readFloat();
|
||||
this.startY = buf.readFloat();
|
||||
this.startZ = buf.readFloat();
|
||||
this.endX = buf.readFloat();
|
||||
this.endY = buf.readFloat();
|
||||
this.endZ = buf.readFloat();
|
||||
this.speed = buf.readFloat();
|
||||
this.color = buf.readInt();
|
||||
this.scale = buf.readFloat();
|
||||
this(new Vector3f(startX, startY, startZ), new Vector3f(endX, endY, endZ), speed, color, scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
buf.writeFloat(this.startX);
|
||||
buf.writeFloat(this.startY);
|
||||
buf.writeFloat(this.startZ);
|
||||
buf.writeFloat(this.endX);
|
||||
buf.writeFloat(this.endY);
|
||||
buf.writeFloat(this.endZ);
|
||||
buf.writeFloat(this.speed);
|
||||
buf.writeInt(this.color);
|
||||
buf.writeFloat(this.scale);
|
||||
public Type<? extends CustomPacketPayload> type() {
|
||||
return PacketParticleStream.TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation id() {
|
||||
return PacketParticleStream.ID;
|
||||
}
|
||||
|
||||
public static void onMessage(PacketParticleStream message, PlayPayloadContext ctx) {
|
||||
ctx.workHandler().execute(() -> NaturesAuraAPI.instance().spawnParticleStream(
|
||||
message.startX, message.startY, message.startZ,
|
||||
message.endX, message.endY, message.endZ,
|
||||
message.speed, message.color, message.scale));
|
||||
public static void onMessage(PacketParticleStream message, IPayloadContext ctx) {
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
message.start.x, message.start.y, message.start.z,
|
||||
message.end.x, message.end.y, message.end.z,
|
||||
message.speed, message.color, message.scale);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,66 +11,43 @@ import net.minecraft.client.renderer.BiomeColors;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ItemParticleOption;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.neoforged.neoforge.network.handling.PlayPayloadContext;
|
||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public class PacketParticles implements CustomPacketPayload {
|
||||
public record PacketParticles(float posX, float posY, float posZ, int particleType, List<Integer> data) implements CustomPacketPayload {
|
||||
|
||||
public static final ResourceLocation ID = new ResourceLocation(NaturesAura.MOD_ID, "particles");
|
||||
public static final CustomPacketPayload.Type<PacketParticles> TYPE = new CustomPacketPayload.Type<>(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, "particles"));
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, PacketParticles> CODEC = StreamCodec.composite(
|
||||
ByteBufCodecs.FLOAT, PacketParticles::posX,
|
||||
ByteBufCodecs.FLOAT, PacketParticles::posY,
|
||||
ByteBufCodecs.FLOAT, PacketParticles::posZ,
|
||||
ByteBufCodecs.INT, PacketParticles::particleType,
|
||||
ByteBufCodecs.collection(ArrayList::new, ByteBufCodecs.INT), PacketParticles::data,
|
||||
PacketParticles::new);
|
||||
|
||||
private final float posX;
|
||||
private final float posY;
|
||||
private final float posZ;
|
||||
private final Type type;
|
||||
private final int[] data;
|
||||
|
||||
public PacketParticles(float posX, float posY, float posZ, Type type, int... data) {
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public PacketParticles(FriendlyByteBuf buf) {
|
||||
this.posX = buf.readFloat();
|
||||
this.posY = buf.readFloat();
|
||||
this.posZ = buf.readFloat();
|
||||
this.type = Type.values()[buf.readByte()];
|
||||
|
||||
this.data = new int[buf.readByte()];
|
||||
for (var i = 0; i < this.data.length; i++)
|
||||
this.data[i] = buf.readInt();
|
||||
public PacketParticles(float posX, float posY, float posZ, Type particleType, int... data) {
|
||||
this(posX, posY, posZ, particleType.ordinal(), Arrays.stream(data).boxed().toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
buf.writeFloat(this.posX);
|
||||
buf.writeFloat(this.posY);
|
||||
buf.writeFloat(this.posZ);
|
||||
buf.writeByte(this.type.ordinal());
|
||||
|
||||
buf.writeByte(this.data.length);
|
||||
for (var i : this.data)
|
||||
buf.writeInt(i);
|
||||
public CustomPacketPayload.Type<? extends CustomPacketPayload> type() {
|
||||
return PacketParticles.TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation id() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void onMessage(PacketParticles message, PlayPayloadContext ctx) {
|
||||
ctx.workHandler().execute(() -> {
|
||||
var level = ctx.level().orElseThrow();
|
||||
if (level != null)
|
||||
message.type.action.accept(message, level);
|
||||
});
|
||||
public static void onMessage(PacketParticles message, IPayloadContext ctx) {
|
||||
var level = Minecraft.getInstance().level;
|
||||
if (level != null)
|
||||
Type.values()[message.particleType].action.accept(message, level);
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
|
@ -80,107 +57,107 @@ public class PacketParticles implements CustomPacketPayload {
|
|||
var state = level.getBlockState(dustPos);
|
||||
var box = state.getShape(level, dustPos).bounds();
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
dustPos.getX() + box.minX + (box.maxX - box.minX) * level.random.nextFloat(),
|
||||
dustPos.getY() + 0.1F,
|
||||
dustPos.getZ() + box.minZ + (box.maxZ - box.minZ) * level.random.nextFloat(),
|
||||
(float) level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextFloat() * 0.01F + 0.02F,
|
||||
(float) level.random.nextGaussian() * 0.02F,
|
||||
0xf4cb42, 2F, 50, 0F, false, true);
|
||||
dustPos.getX() + box.minX + (box.maxX - box.minX) * level.random.nextFloat(),
|
||||
dustPos.getY() + 0.1F,
|
||||
dustPos.getZ() + box.minZ + (box.maxZ - box.minZ) * level.random.nextFloat(),
|
||||
(float) level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextFloat() * 0.01F + 0.02F,
|
||||
(float) level.random.nextGaussian() * 0.02F,
|
||||
0xf4cb42, 2F, 50, 0F, false, true);
|
||||
return true;
|
||||
});
|
||||
}),
|
||||
TR_CONSUME_ITEM((message, level) -> {
|
||||
for (var i = level.random.nextInt(20) + 10; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.5F, message.posY + 0.9F, message.posZ + 0.5F,
|
||||
(float) level.random.nextGaussian() * 0.04F, level.random.nextFloat() * 0.04F, (float) level.random.nextGaussian() * 0.04F,
|
||||
0x89cc37, 1.5F, 25, 0F, false, true);
|
||||
message.posX + 0.5F, message.posY + 0.9F, message.posZ + 0.5F,
|
||||
(float) level.random.nextGaussian() * 0.04F, level.random.nextFloat() * 0.04F, (float) level.random.nextGaussian() * 0.04F,
|
||||
0x89cc37, 1.5F, 25, 0F, false, true);
|
||||
}
|
||||
}),
|
||||
TR_DISAPPEAR((message, level) -> {
|
||||
for (var i = level.random.nextInt(5) + 3; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + level.random.nextFloat(), message.posY + level.random.nextFloat(), message.posZ + level.random.nextFloat(),
|
||||
0F, 0F, 0F,
|
||||
0x33FF33, 1F, 50, 0F, false, true);
|
||||
message.posX + level.random.nextFloat(), message.posY + level.random.nextFloat(), message.posZ + level.random.nextFloat(),
|
||||
0F, 0F, 0F,
|
||||
0x33FF33, 1F, 50, 0F, false, true);
|
||||
}
|
||||
}),
|
||||
TR_SPAWN_RESULT((message, level) -> {
|
||||
for (var i = level.random.nextInt(10) + 10; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY, message.posZ,
|
||||
level.random.nextGaussian() * 0.1F, level.random.nextGaussian() * 0.1F, level.random.nextGaussian() * 0.1F,
|
||||
0x89cc37, 2F, 100, 0F, true, true);
|
||||
message.posX, message.posY, message.posZ,
|
||||
level.random.nextGaussian() * 0.1F, level.random.nextGaussian() * 0.1F, level.random.nextGaussian() * 0.1F,
|
||||
0x89cc37, 2F, 100, 0F, true, true);
|
||||
}
|
||||
}),
|
||||
ALTAR_CONVERSION((message, level) -> {
|
||||
var color = message.data[0];
|
||||
var color = message.data.getFirst();
|
||||
for (var i = level.random.nextInt(5) + 2; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 0.9F + 0.25F * level.random.nextFloat(),
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.02F, level.random.nextFloat() * 0.02F, level.random.nextGaussian() * 0.02F,
|
||||
color, level.random.nextFloat() * 1.5F + 0.75F, 20, 0F, false, true);
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 0.9F + 0.25F * level.random.nextFloat(),
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.02F, level.random.nextFloat() * 0.02F, level.random.nextGaussian() * 0.02F,
|
||||
color, level.random.nextFloat() * 1.5F + 0.75F, 20, 0F, false, true);
|
||||
}
|
||||
}),
|
||||
POTION_GEN((message, level) -> {
|
||||
var color = message.data[0];
|
||||
var releaseAura = message.data[1] > 0;
|
||||
var color = message.data.getFirst();
|
||||
var releaseAura = message.data.get(1) > 0;
|
||||
for (var i = level.random.nextInt(5) + 5; i >= 0; i--) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + level.random.nextFloat(),
|
||||
message.posY + 1.1F,
|
||||
message.posZ + level.random.nextFloat(),
|
||||
level.random.nextGaussian() * 0.01F, level.random.nextFloat() * 0.1F, level.random.nextGaussian() * 0.01F,
|
||||
color, 2F + level.random.nextFloat(), 40, 0F, true, true);
|
||||
message.posX + level.random.nextFloat(),
|
||||
message.posY + 1.1F,
|
||||
message.posZ + level.random.nextFloat(),
|
||||
level.random.nextGaussian() * 0.01F, level.random.nextFloat() * 0.1F, level.random.nextGaussian() * 0.01F,
|
||||
color, 2F + level.random.nextFloat(), 40, 0F, true, true);
|
||||
|
||||
if (releaseAura)
|
||||
for (var x = -1; x <= 1; x += 2)
|
||||
for (var 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,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextFloat() * 0.04F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
0xd6340c, 1F + level.random.nextFloat() * 2F, 75, 0F, true, true);
|
||||
message.posX + x * 3 + 0.5F,
|
||||
message.posY + 2.5,
|
||||
message.posZ + z * 3 + 0.5F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextFloat() * 0.04F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
0xd6340c, 1F + level.random.nextFloat() * 2F, 75, 0F, true, true);
|
||||
}
|
||||
}
|
||||
}),
|
||||
PLANT_BOOST((message, level) -> {
|
||||
for (var i = level.random.nextInt(20) + 15; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + level.random.nextFloat(),
|
||||
message.posY + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posZ + level.random.nextFloat(),
|
||||
0F, level.random.nextFloat() * 0.02F, 0F,
|
||||
0x5ccc30, 1F + level.random.nextFloat() * 2F, 50, 0F, false, true);
|
||||
message.posX + level.random.nextFloat(),
|
||||
message.posY + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posZ + level.random.nextFloat(),
|
||||
0F, level.random.nextFloat() * 0.02F, 0F,
|
||||
0x5ccc30, 1F + level.random.nextFloat() * 2F, 50, 0F, false, true);
|
||||
}),
|
||||
FLOWER_GEN_CONSUME((message, level) -> {
|
||||
var color = message.data[0];
|
||||
var color = message.data.getFirst();
|
||||
for (var i = level.random.nextInt(10) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
color, level.random.nextFloat() * 2F + 1F, 25, 0F, false, true);
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
color, level.random.nextFloat() * 2F + 1F, 25, 0F, false, true);
|
||||
}),
|
||||
FLOWER_GEN_AURA_CREATION((message, level) -> {
|
||||
for (var i = level.random.nextInt(10) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + level.random.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + level.random.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
}),
|
||||
PLACER_PLACING((message, level) -> {
|
||||
for (var i = level.random.nextInt(20) + 20; i >= 0; i--) {
|
||||
|
@ -188,181 +165,181 @@ public class PacketParticles implements CustomPacketPayload {
|
|||
var x = side ? level.random.nextFloat() : level.random.nextBoolean() ? 1.1F : -0.1F;
|
||||
var z = !side ? level.random.nextFloat() : level.random.nextBoolean() ? 1.1F : -0.1F;
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + x, message.posY + 0.1F + level.random.nextFloat() * 0.98F, message.posZ + z,
|
||||
0F, 0F, 0F,
|
||||
0xad7a37, level.random.nextFloat() + 1F, 50, 0F, true, true);
|
||||
message.posX + x, message.posY + 0.1F + level.random.nextFloat() * 0.98F, message.posZ + z,
|
||||
0F, 0F, 0F,
|
||||
0xad7a37, level.random.nextFloat() + 1F, 50, 0F, true, true);
|
||||
}
|
||||
}),
|
||||
HOPPER_UPGRADE((message, level) -> {
|
||||
for (var i = level.random.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.45F, message.posZ,
|
||||
level.random.nextGaussian() * 0.015F,
|
||||
level.random.nextGaussian() * 0.015F,
|
||||
level.random.nextGaussian() * 0.015F,
|
||||
0xdde7ff, level.random.nextFloat() + 1F, 30, -0.06F, true, true);
|
||||
message.posX, message.posY + 0.45F, message.posZ,
|
||||
level.random.nextGaussian() * 0.015F,
|
||||
level.random.nextGaussian() * 0.015F,
|
||||
level.random.nextGaussian() * 0.015F,
|
||||
0xdde7ff, level.random.nextFloat() + 1F, 30, -0.06F, true, true);
|
||||
}),
|
||||
SHOCKWAVE_CREATOR((message, level) -> {
|
||||
for (var i = 0; i < 360; i += 2) {
|
||||
var 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);
|
||||
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);
|
||||
}
|
||||
}),
|
||||
OAK_GENERATOR((message, level) -> {
|
||||
var sapX = message.data[0];
|
||||
var sapY = message.data[1];
|
||||
var sapZ = message.data[2];
|
||||
var releaseAura = message.data[3] > 0;
|
||||
var sapX = message.data.getFirst();
|
||||
var sapY = message.data.get(1);
|
||||
var sapZ = message.data.get(2);
|
||||
var releaseAura = message.data.get(3) > 0;
|
||||
for (var i = level.random.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
sapX + 0.5F + (float) level.random.nextGaussian() * 3F,
|
||||
sapY + 0.5F + level.random.nextFloat() * 4F,
|
||||
sapZ + 0.5F + (float) level.random.nextGaussian() * 3F,
|
||||
message.posX + 0.5F,
|
||||
message.posY + 0.5F,
|
||||
message.posZ + 0.5F,
|
||||
0.6F, BiomeColors.getAverageGrassColor(level, new BlockPos(sapX, sapY, sapZ)), 1.5F);
|
||||
sapX + 0.5F + (float) level.random.nextGaussian() * 3F,
|
||||
sapY + 0.5F + level.random.nextFloat() * 4F,
|
||||
sapZ + 0.5F + (float) level.random.nextGaussian() * 3F,
|
||||
message.posX + 0.5F,
|
||||
message.posY + 0.5F,
|
||||
message.posZ + 0.5F,
|
||||
0.6F, BiomeColors.getAverageGrassColor(level, new BlockPos(sapX, sapY, sapZ)), 1.5F);
|
||||
if (releaseAura)
|
||||
for (var i = level.random.nextInt(10) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.03F,
|
||||
level.random.nextFloat() * 0.04F + 0.04F,
|
||||
level.random.nextGaussian() * 0.03F,
|
||||
0x5ccc30, 1F + level.random.nextFloat() * 1.5F, 60, 0F, false, true);
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.03F,
|
||||
level.random.nextFloat() * 0.04F + 0.04F,
|
||||
level.random.nextGaussian() * 0.03F,
|
||||
0x5ccc30, 1F + level.random.nextFloat() * 1.5F, 60, 0F, false, true);
|
||||
}),
|
||||
OFFERING_TABLE((message, level) -> {
|
||||
var genX = message.data[0];
|
||||
var genY = message.data[1];
|
||||
var genZ = message.data[2];
|
||||
var genX = message.data.getFirst();
|
||||
var genY = message.data.get(1);
|
||||
var genZ = message.data.get(2);
|
||||
for (var i = level.random.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextFloat() * 0.25F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
0xffadfd, 1.5F, 40, 0F, false, true);
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextFloat() * 0.25F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
0xffadfd, 1.5F, 40, 0F, false, true);
|
||||
for (var i = level.random.nextInt(50) + 30; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
genX + 0.5F + level.random.nextGaussian() * 2.5F,
|
||||
genY + 0.1F,
|
||||
genZ + 0.5F + level.random.nextGaussian() * 2.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.01F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0xd3e4ff, 1.5F, 150, 0F, false, true);
|
||||
genX + 0.5F + level.random.nextGaussian() * 2.5F,
|
||||
genY + 0.1F,
|
||||
genZ + 0.5F + level.random.nextGaussian() * 2.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.01F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0xd3e4ff, 1.5F, 150, 0F, false, true);
|
||||
}),
|
||||
PICKUP_STOPPER((message, level) -> NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.4F, message.posZ,
|
||||
level.random.nextGaussian() * 0.005F,
|
||||
level.random.nextFloat() * 0.005F,
|
||||
level.random.nextGaussian() * 0.005F,
|
||||
0xcc3116, 1.5F, 40, 0F, false, true)),
|
||||
message.posX, message.posY + 0.4F, message.posZ,
|
||||
level.random.nextGaussian() * 0.005F,
|
||||
level.random.nextFloat() * 0.005F,
|
||||
level.random.nextGaussian() * 0.005F,
|
||||
0xcc3116, 1.5F, 40, 0F, false, true)),
|
||||
SPAWN_LAMP((message, level) -> {
|
||||
for (var i = level.random.nextInt(5) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.3F + level.random.nextFloat() * 0.4F,
|
||||
message.posY + 0.15F + level.random.nextFloat() * 0.5F,
|
||||
message.posZ + 0.3F + level.random.nextFloat() * 0.4F,
|
||||
0F, 0F, 0F,
|
||||
0xf4a142, 1F, 30, 0F, false, true);
|
||||
message.posX + 0.3F + level.random.nextFloat() * 0.4F,
|
||||
message.posY + 0.15F + level.random.nextFloat() * 0.5F,
|
||||
message.posZ + 0.3F + level.random.nextFloat() * 0.4F,
|
||||
0F, 0F, 0F,
|
||||
0xf4a142, 1F, 30, 0F, false, true);
|
||||
}),
|
||||
ANIMAL_GEN_CREATE((message, level) -> {
|
||||
for (var i = level.random.nextInt(5) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0xd13308, 1F + level.random.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0xd13308, 1F + level.random.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
}),
|
||||
ANIMAL_GEN_CONSUME((message, level) -> {
|
||||
var child = message.data[0] > 0;
|
||||
var height = message.data[1] / 10F;
|
||||
var genX = message.data[2];
|
||||
var genY = message.data[3];
|
||||
var genZ = message.data[4];
|
||||
var child = message.data.getFirst() > 0;
|
||||
var height = message.data.get(1) / 10F;
|
||||
var genX = message.data.get(2);
|
||||
var genY = message.data.get(3);
|
||||
var genZ = message.data.get(4);
|
||||
for (var i = child ? level.random.nextInt(10) + 10 : level.random.nextInt(20) + 20; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + level.random.nextGaussian() * 0.25F,
|
||||
message.posY + height * 0.75F + level.random.nextGaussian() * 0.25F,
|
||||
message.posZ + level.random.nextGaussian() * 0.25F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.01F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0x42f4c8, level.random.nextFloat() * (child ? 0.5F : 2F) + 1F, level.random.nextInt(30) + 40, 0F, true, true);
|
||||
message.posX + level.random.nextGaussian() * 0.25F,
|
||||
message.posY + height * 0.75F + level.random.nextGaussian() * 0.25F,
|
||||
message.posZ + level.random.nextGaussian() * 0.25F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.01F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0x42f4c8, level.random.nextFloat() * (child ? 0.5F : 2F) + 1F, level.random.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);
|
||||
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);
|
||||
}),
|
||||
END_FLOWER_DECAY((message, level) -> {
|
||||
var color = message.data[0];
|
||||
var color = message.data.getFirst();
|
||||
for (var i = level.random.nextInt(10) + 20; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + level.random.nextFloat(),
|
||||
message.posY + level.random.nextFloat(),
|
||||
message.posZ + level.random.nextFloat(),
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.01F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
color, 1.5F, 80, 0F, true, true);
|
||||
message.posX + level.random.nextFloat(),
|
||||
message.posY + level.random.nextFloat(),
|
||||
message.posZ + level.random.nextFloat(),
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.01F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
color, 1.5F, 80, 0F, true, true);
|
||||
}),
|
||||
ANIMAL_SPAWNER((message, level) -> {
|
||||
for (var i = level.random.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextFloat() * 0.02F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
0x16b7b2, 1.5F, 40, 0F, false, true);
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextFloat() * 0.02F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
0x16b7b2, 1.5F, 40, 0F, false, true);
|
||||
}),
|
||||
RF_CONVERTER((message, level) -> {
|
||||
for (var i = level.random.nextInt(5) + 2; i >= 0; i--)
|
||||
Multiblocks.RF_CONVERTER.forEach(BlockPos.containing(message.posX, message.posY, message.posZ), 'R', (blockPos, matcher) -> {
|
||||
if (level.random.nextFloat() < 0.35F) {
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
blockPos.getX() + level.random.nextFloat(),
|
||||
blockPos.getY() + level.random.nextFloat(),
|
||||
blockPos.getZ() + level.random.nextFloat(),
|
||||
message.posX + level.random.nextFloat(),
|
||||
message.posY + level.random.nextFloat(),
|
||||
message.posZ + level.random.nextFloat(),
|
||||
0.05F, 0xff1a05, 1.5F);
|
||||
blockPos.getX() + level.random.nextFloat(),
|
||||
blockPos.getY() + level.random.nextFloat(),
|
||||
blockPos.getZ() + level.random.nextFloat(),
|
||||
message.posX + level.random.nextFloat(),
|
||||
message.posY + level.random.nextFloat(),
|
||||
message.posZ + level.random.nextFloat(),
|
||||
0.05F, 0xff1a05, 1.5F);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}),
|
||||
END_FLOWER_CONSUME((message, level) -> {
|
||||
var color = message.data[0];
|
||||
var color = message.data.getFirst();
|
||||
for (var i = level.random.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.01F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
color, 1.5F, 40, 0F, false, true);
|
||||
message.posX, message.posY + 0.5F, message.posZ,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.01F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
color, 1.5F, 40, 0F, false, true);
|
||||
}),
|
||||
MOVER_CART((message, level) -> {
|
||||
var motionX = message.data[0] / 100F;
|
||||
var motionY = message.data[1] / 100F;
|
||||
var motionZ = message.data[2] / 100F;
|
||||
var motionX = message.data.getFirst() / 100F;
|
||||
var motionY = message.data.get(1) / 100F;
|
||||
var motionZ = message.data.get(2) / 100F;
|
||||
for (var i = level.random.nextInt(60) + 30; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + level.random.nextGaussian() * 10F,
|
||||
message.posY + level.random.nextGaussian() * 10F,
|
||||
message.posZ + level.random.nextGaussian() * 10F,
|
||||
motionX * 0.2F, motionY * 0.2F, motionZ * 0.2F,
|
||||
IAuraType.forLevel(level).getColor(), 2F, 30, 0F, false, true);
|
||||
message.posX + level.random.nextGaussian() * 10F,
|
||||
message.posY + level.random.nextGaussian() * 10F,
|
||||
message.posZ + level.random.nextGaussian() * 10F,
|
||||
motionX * 0.2F, motionY * 0.2F, motionZ * 0.2F,
|
||||
IAuraType.forLevel(level).getColor(), 2F, 30, 0F, false, true);
|
||||
}),
|
||||
MOSS_GENERATOR((message, level) -> {
|
||||
for (var i = level.random.nextInt(30) + 30; i >= 0; i--) {
|
||||
|
@ -371,100 +348,100 @@ public class PacketParticles implements CustomPacketPayload {
|
|||
var y = side != 1 ? level.random.nextFloat() : level.random.nextBoolean() ? 1.1F : -0.1F;
|
||||
var z = side != 2 ? level.random.nextFloat() : level.random.nextBoolean() ? 1.1F : -0.1F;
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + x,
|
||||
message.posY + y,
|
||||
message.posZ + z,
|
||||
0F, 0F, 0F,
|
||||
0x184c0d, level.random.nextFloat() + 1F, 30, 0F, true, true);
|
||||
message.posX + x,
|
||||
message.posY + y,
|
||||
message.posZ + z,
|
||||
0F, 0F, 0F,
|
||||
0x184c0d, level.random.nextFloat() + 1F, 30, 0F, true, true);
|
||||
}
|
||||
for (var i = level.random.nextInt(20) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + level.random.nextFloat(),
|
||||
message.posY + 1F,
|
||||
message.posZ + level.random.nextFloat(),
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + level.random.nextFloat() * 1.5F, 40, 0F, true, true);
|
||||
message.posX + level.random.nextFloat(),
|
||||
message.posY + 1F,
|
||||
message.posZ + level.random.nextFloat(),
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + level.random.nextFloat() * 1.5F, 40, 0F, true, true);
|
||||
}),
|
||||
FIREWORK_GEN((message, level) -> {
|
||||
var goalX = message.data[0];
|
||||
var goalY = message.data[1];
|
||||
var goalZ = message.data[2];
|
||||
var goalX = message.data.getFirst();
|
||||
var goalY = message.data.get(1);
|
||||
var goalZ = message.data.get(2);
|
||||
NaturesAuraAPI.instance().setParticleSpawnRange(64);
|
||||
for (var i = level.random.nextInt(30) + 30; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
message.posX + (float) level.random.nextGaussian(),
|
||||
message.posY + (float) level.random.nextGaussian(),
|
||||
message.posZ + (float) level.random.nextGaussian(),
|
||||
goalX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
goalY + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
goalZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
0.65F, message.data[3 + level.random.nextInt(message.data.length - 3)], 1F);
|
||||
message.posX + (float) level.random.nextGaussian(),
|
||||
message.posY + (float) level.random.nextGaussian(),
|
||||
message.posZ + (float) level.random.nextGaussian(),
|
||||
goalX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
goalY + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
goalZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
0.65F, message.data.get(3 + level.random.nextInt(message.data.size() - 3)), 1F);
|
||||
NaturesAuraAPI.instance().setParticleSpawnRange(32);
|
||||
}),
|
||||
DIMENSION_RAIL((message, level) -> {
|
||||
var width = message.data[0] / 100F;
|
||||
var height = message.data[1] / 100F;
|
||||
var depth = message.data[2] / 100F;
|
||||
var width = message.data.getFirst() / 100F;
|
||||
var height = message.data.get(1) / 100F;
|
||||
var depth = message.data.get(2) / 100F;
|
||||
for (var i = level.random.nextInt(100) + 50; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + level.random.nextFloat() * width,
|
||||
message.posY + level.random.nextFloat() * height,
|
||||
message.posZ + level.random.nextFloat() * depth,
|
||||
0F, 0F, 0F, 0xd60cff, 1F + level.random.nextFloat(), 60, 0F, false, true);
|
||||
message.posX + level.random.nextFloat() * width,
|
||||
message.posY + level.random.nextFloat() * height,
|
||||
message.posZ + level.random.nextFloat() * depth,
|
||||
0F, 0F, 0F, 0xd60cff, 1F + level.random.nextFloat(), 60, 0F, false, true);
|
||||
}),
|
||||
PROJECTILE_GEN((message, level) -> {
|
||||
var x = message.data[0];
|
||||
var y = message.data[1];
|
||||
var z = message.data[2];
|
||||
var x = message.data.getFirst();
|
||||
var y = message.data.get(1);
|
||||
var z = message.data.get(2);
|
||||
for (var i = level.random.nextInt(10) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
x + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
y + 1.01F,
|
||||
z + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + level.random.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
x + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
y + 1.01F,
|
||||
z + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
0x5ccc30, 1F + level.random.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
for (var i = level.random.nextInt(10) + 10; i >= 0; i--)
|
||||
level.addParticle(ParticleTypes.FIREWORK,
|
||||
message.posX, message.posY, message.posZ,
|
||||
level.random.nextGaussian() * 0.03F,
|
||||
level.random.nextGaussian() * 0.03F,
|
||||
level.random.nextGaussian() * 0.03F);
|
||||
message.posX, message.posY, message.posZ,
|
||||
level.random.nextGaussian() * 0.03F,
|
||||
level.random.nextGaussian() * 0.03F,
|
||||
level.random.nextGaussian() * 0.03F);
|
||||
}),
|
||||
BLAST_FURNACE_BOOSTER((message, level) -> {
|
||||
var worked = message.data[0] > 0;
|
||||
var worked = message.data.getFirst() > 0;
|
||||
for (var i = level.random.nextInt(10) + 5; i >= 0; i--)
|
||||
level.addParticle(ParticleTypes.CAMPFIRE_COSY_SMOKE,
|
||||
message.posX + 5 / 16F + level.random.nextInt(6) / 16F,
|
||||
message.posY + 0.6F,
|
||||
message.posZ + 5 / 16F + level.random.nextInt(6) / 16F,
|
||||
level.random.nextGaussian() * 0.005F,
|
||||
level.random.nextFloat() * 0.02F + 0.01F,
|
||||
level.random.nextGaussian() * 0.005F);
|
||||
message.posX + 5 / 16F + level.random.nextInt(6) / 16F,
|
||||
message.posY + 0.6F,
|
||||
message.posZ + 5 / 16F + level.random.nextInt(6) / 16F,
|
||||
level.random.nextGaussian() * 0.005F,
|
||||
level.random.nextFloat() * 0.02F + 0.01F,
|
||||
level.random.nextGaussian() * 0.005F);
|
||||
|
||||
if (worked) {
|
||||
var pos = BlockPos.containing(message.posX, message.posY, message.posZ);
|
||||
var color = IAuraChunk.getAuraChunk(level, pos).getType().getColor();
|
||||
for (var i = level.random.nextInt(10) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
message.posX + (float) level.random.nextGaussian() * 5,
|
||||
message.posY + level.random.nextFloat() * 5,
|
||||
message.posZ + (float) level.random.nextGaussian() * 5,
|
||||
message.posX + 0.5F, message.posY + 0.5F, message.posZ + 0.5F,
|
||||
0.25F, color, 0.5F + level.random.nextFloat()
|
||||
message.posX + (float) level.random.nextGaussian() * 5,
|
||||
message.posY + level.random.nextFloat() * 5,
|
||||
message.posZ + (float) level.random.nextGaussian() * 5,
|
||||
message.posX + 0.5F, message.posY + 0.5F, message.posZ + 0.5F,
|
||||
0.25F, color, 0.5F + level.random.nextFloat()
|
||||
);
|
||||
}
|
||||
}),
|
||||
ANIMAL_CONTAINER((message, level) -> {
|
||||
for (var i = level.random.nextInt(2) + 1; i > 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + level.random.nextGaussian() * 0.15F,
|
||||
message.posY - level.random.nextFloat() * 0.5F,
|
||||
message.posZ + level.random.nextGaussian() * 0.15F,
|
||||
0, 0, 0, 0x42e9f5, 1 + level.random.nextFloat() * 2, 40, 0, false, true
|
||||
message.posX + level.random.nextGaussian() * 0.15F,
|
||||
message.posY - level.random.nextFloat() * 0.5F,
|
||||
message.posZ + level.random.nextGaussian() * 0.15F,
|
||||
0, 0, 0, 0x42e9f5, 1 + level.random.nextFloat() * 2, 40, 0, false, true
|
||||
);
|
||||
}),
|
||||
SNOW_CREATOR((message, level) -> {
|
||||
|
@ -472,43 +449,43 @@ public class PacketParticles implements CustomPacketPayload {
|
|||
var color = IAuraChunk.getAuraChunk(level, pos).getType().getColor();
|
||||
for (var i = level.random.nextInt(3) + 1; i > 0; i--)
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
message.posX + (float) level.random.nextGaussian() * 5,
|
||||
message.posY + level.random.nextFloat() * 5,
|
||||
message.posZ + (float) level.random.nextGaussian() * 5,
|
||||
message.posX + 0.5F, message.posY + 0.5F, message.posZ + 0.5F,
|
||||
0.25F, color, 0.5F + level.random.nextFloat()
|
||||
message.posX + (float) level.random.nextGaussian() * 5,
|
||||
message.posY + level.random.nextFloat() * 5,
|
||||
message.posZ + (float) level.random.nextGaussian() * 5,
|
||||
message.posX + 0.5F, message.posY + 0.5F, message.posZ + 0.5F,
|
||||
0.25F, color, 0.5F + level.random.nextFloat()
|
||||
);
|
||||
}),
|
||||
CHORUS_GENERATOR((message, level) -> {
|
||||
var chorusX = message.data[0];
|
||||
var chorusY = message.data[1];
|
||||
var chorusZ = message.data[2];
|
||||
var chorusX = message.data.getFirst();
|
||||
var chorusY = message.data.get(1);
|
||||
var chorusZ = message.data.get(2);
|
||||
for (var i = level.random.nextInt(5) + 3; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
chorusX + level.random.nextFloat(), chorusY + level.random.nextFloat(), chorusZ + level.random.nextFloat(),
|
||||
0F, 0F, 0F,
|
||||
0xbb0be3, 1F + level.random.nextFloat(), 50, 0F, false, true);
|
||||
chorusX + level.random.nextFloat(), chorusY + level.random.nextFloat(), chorusZ + level.random.nextFloat(),
|
||||
0F, 0F, 0F,
|
||||
0xbb0be3, 1F + level.random.nextFloat(), 50, 0F, false, true);
|
||||
for (var i = level.random.nextInt(5) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
IAuraType.forLevel(level).getColor(), 1F + level.random.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
IAuraType.forLevel(level).getColor(), 1F + level.random.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
}),
|
||||
TIMER_RESET((message, level) -> {
|
||||
var color = message.data[0];
|
||||
var color = message.data.getFirst();
|
||||
for (var i = level.random.nextInt(10) + 15; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 5 / 16F + level.random.nextFloat() * 6 / 16F,
|
||||
message.posY + 2 / 16F + level.random.nextFloat() * 8 / 16F,
|
||||
message.posZ + 5 / 16F + level.random.nextFloat() * 6 / 16F,
|
||||
0, 0, 0, color, 2, 40 + level.random.nextInt(20), 0, false, true);
|
||||
message.posX + 5 / 16F + level.random.nextFloat() * 6 / 16F,
|
||||
message.posY + 2 / 16F + level.random.nextFloat() * 8 / 16F,
|
||||
message.posZ + 5 / 16F + level.random.nextFloat() * 6 / 16F,
|
||||
0, 0, 0, color, 2, 40 + level.random.nextInt(20), 0, false, true);
|
||||
}),
|
||||
STRUCTURE_FINDER((message, level) -> {
|
||||
var entity = (EntityStructureFinder) level.getEntity(message.data[0]);
|
||||
var entity = (EntityStructureFinder) level.getEntity(message.data.getFirst());
|
||||
var renderer = Minecraft.getInstance().levelRenderer;
|
||||
|
||||
var d0 = message.posX + 0.5D;
|
||||
|
@ -526,45 +503,45 @@ public class PacketParticles implements CustomPacketPayload {
|
|||
SLIME_SPLIT_GEN_CREATE((message, level) -> {
|
||||
for (var i = level.random.nextInt(5) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
message.data[0], 1F + level.random.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
message.posX + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
message.posY + 1.01F,
|
||||
message.posZ + 0.25F + level.random.nextFloat() * 0.5F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.01F,
|
||||
message.data.getFirst(), 1F + level.random.nextFloat() * 1.5F, 40, 0F, false, true);
|
||||
}),
|
||||
SLIME_SPLIT_GEN_START((message, level) -> {
|
||||
var x = message.data[0];
|
||||
var y = message.data[1];
|
||||
var z = message.data[2];
|
||||
var color = message.data[3];
|
||||
var x = message.data.getFirst();
|
||||
var y = message.data.get(1);
|
||||
var z = message.data.get(2);
|
||||
var color = message.data.get(3);
|
||||
for (var i = level.random.nextInt(10) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + (float) level.random.nextGaussian() * 0.5F,
|
||||
message.posY + (float) level.random.nextGaussian() * 0.5F,
|
||||
message.posZ + (float) level.random.nextGaussian() * 0.5F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
color, level.random.nextFloat() + 1, level.random.nextInt(20) + 20, 0, false, true);
|
||||
message.posX + (float) level.random.nextGaussian() * 0.5F,
|
||||
message.posY + (float) level.random.nextGaussian() * 0.5F,
|
||||
message.posZ + (float) level.random.nextGaussian() * 0.5F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
level.random.nextFloat() * 0.04F + 0.02F,
|
||||
level.random.nextGaussian() * 0.02F,
|
||||
color, level.random.nextFloat() + 1, level.random.nextInt(20) + 20, 0, false, true);
|
||||
for (var i = level.random.nextInt(10) + 5; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnParticleStream(
|
||||
message.posX + (float) level.random.nextGaussian() * 0.5F,
|
||||
message.posY + (float) level.random.nextGaussian() * 0.5F,
|
||||
message.posZ + (float) level.random.nextGaussian() * 0.5F,
|
||||
x + 0.5F, y + 0.5F, z + 0.5F, 0.2F, color, level.random.nextFloat() + 1);
|
||||
message.posX + (float) level.random.nextGaussian() * 0.5F,
|
||||
message.posY + (float) level.random.nextGaussian() * 0.5F,
|
||||
message.posZ + (float) level.random.nextGaussian() * 0.5F,
|
||||
x + 0.5F, y + 0.5F, z + 0.5F, 0.2F, color, level.random.nextFloat() + 1);
|
||||
}),
|
||||
PET_REVIVER((message, level) -> {
|
||||
for (var i = level.random.nextInt(50) + 150; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
message.posX + (float) level.random.nextGaussian() * 0.4F,
|
||||
message.posY + (float) level.random.nextGaussian() * 0.4F,
|
||||
message.posZ + (float) level.random.nextGaussian() * 0.4F,
|
||||
level.random.nextGaussian() * 0.002F,
|
||||
level.random.nextFloat() * 0.001F + 0.002F,
|
||||
level.random.nextGaussian() * 0.002F,
|
||||
message.data[0], level.random.nextFloat() * 2 + 1, level.random.nextInt(50) + 50, 0, false, true);
|
||||
message.posX + (float) level.random.nextGaussian() * 0.4F,
|
||||
message.posY + (float) level.random.nextGaussian() * 0.4F,
|
||||
message.posZ + (float) level.random.nextGaussian() * 0.4F,
|
||||
level.random.nextGaussian() * 0.002F,
|
||||
level.random.nextFloat() * 0.001F + 0.002F,
|
||||
level.random.nextGaussian() * 0.002F,
|
||||
message.data.getFirst(), level.random.nextFloat() * 2 + 1, level.random.nextInt(50) + 50, 0, false, true);
|
||||
});
|
||||
|
||||
public final BiConsumer<PacketParticles, Level> action;
|
||||
|
|
Loading…
Reference in a new issue