@@ -180,99 +180,6 @@ public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand han
180180 private double getDistance (double x1 , double y1 , double z1 , double x2 , double y2 , double z2 ){
181181 return Math .sqrt (Math .pow (x1 -x2 , 2 ) + Math .pow (y1 -y2 , 2 ) + Math .pow (z1 -z2 , 2 ));
182182 }
183- /*
184- @Override
185- public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
186- ItemStack itemStack = user.getStackInHand(hand);
187- world.playSound(null, user.getX(), user.getY(), user.getZ(), SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.NEUTRAL, 0.5f, 0.3f / (world.getRandom().nextFloat() * 0.4f + 0.8f));
188- if (world.isClient()) {
189- } else {
190- double i = user.getX();
191- double j = user.getY();
192- double k = user.getZ();
193- float f = 128.0f;
194- Box box = new Box((float) i - f, (float) j - f, (float) k - f, (float) (i + 1) + f, (float) (j + 1) + f, (float) (k + 1) + f);
195- List<PylonEntity> pylons = user.world.getEntitiesByType(TypeFilter.instanceOf(PylonEntity.class), box, pylonEntity -> PylonEntity.isOwner(pylonEntity, user.getEntityName()));
196- if (!pylons.isEmpty()) {
197- PylonEntity pylon = pylons.get(0);
198- if (!user.isSneaking()) {
199- for (int amount = 0; amount < 10; amount++) {
200- MinecraftClient.getInstance().world.addParticle(ParticleTypes.GLOW_SQUID_INK, user.getX(), user.getY(), user.getZ(), 0.0 + world.getRandom().nextFloat() * 0.2f - 0.1f, 0.3 + world.getRandom().nextFloat() * 0.7f, 0.0 + world.getRandom().nextFloat() * 0.2f - 0.1f);
201- MinecraftClient.getInstance().world.addParticle(ParticleTypes.GLOW_SQUID_INK, pylon.getX(), pylon.getY(), pylon.getZ(), 0.0 + world.getRandom().nextFloat() * 0.2f - 0.1f, 0.3 + world.getRandom().nextFloat() * 0.7f, 0.0 + world.getRandom().nextFloat() * 0.2f - 0.1f);
202- MinecraftClient.getInstance().world.addParticle(ParticleTypes.WITCH, user.getX(), user.getY(), user.getZ(), 0.0 + world.getRandom().nextFloat() * 0.8f - 0.4f, 0.4 + world.getRandom().nextFloat() * 0.3f, 0.0 + world.getRandom().nextFloat() * 0.8f - 0.4f);
203- MinecraftClient.getInstance().world.addParticle(ParticleTypes.WITCH, pylon.getX(), pylon.getY(), pylon.getZ(), 0.0 + world.getRandom().nextFloat() * 0.8f - 0.4f, 0.4 + world.getRandom().nextFloat() * 0.3f, 0.0 + world.getRandom().nextFloat() * 0.8f - 0.4f);
204- }
205- ((ServerPlayerEntity) user).networkHandler.requestTeleport(pylon.getX(), pylon.getY(), pylon.getZ(), user.getYaw(), user.getPitch(), EnumSet.noneOf(PlayerPositionLookS2CPacket.Flag.class));
206- MinecraftClient.getInstance().player.setVelocity(0.0f, 0.5f, 0.0f);
207- world.playSound(null, user.getX(), user.getY(), user.getZ(), SoundEvents.AMBIENT_UNDERWATER_ENTER, SoundCategory.NEUTRAL, 0.7f, 0.8f / (world.getRandom().nextFloat() * 0.4f + 0.8f));
208- world.playSound(null, pylon.getX(), pylon.getY(), pylon.getZ(), SoundEvents.AMBIENT_UNDERWATER_ENTER, SoundCategory.NEUTRAL, 0.7f, 0.8f / (world.getRandom().nextFloat() * 0.4f + 0.8f));
209- }
210- else{
211- for (int amount = 0; amount < 45; amount++) {
212- MinecraftClient.getInstance().world.addParticle(ParticleTypes.GLOW_SQUID_INK, pylon.getX(), pylon.getY() + 0.2f, pylon.getZ(), Math.sin(amount*8.0f)*1.2f, 0, Math.cos(amount*8.0f)*1.2f);
213- MinecraftClient.getInstance().world.addParticle(ParticleTypes.SQUID_INK, pylon.getX(), pylon.getY() + 1.2f, pylon.getZ(), Math.sin(amount*8.0f)*1.4f, 0, Math.cos(amount*8.0f)*1.4f);
214- MinecraftClient.getInstance().world.addParticle(ParticleTypes.GLOW_SQUID_INK, pylon.getX(), pylon.getY() + 2.2f, pylon.getZ(), Math.sin(amount*8.0f)*1.2f, 0, Math.cos(amount*8.0f)*1.2f);
215- }
216- world.playSound(null, pylon.getX(), pylon.getY(), pylon.getZ(), SoundEvents.BLOCK_BELL_USE, SoundCategory.NEUTRAL, 0.5f, 1.5f);
217- float strength = -0.16f;
218- float vStrength = 0.05f;
219- List<Entity> pl = world.getOtherEntities(pylon, new Box(pylon.getX()-16, pylon.getY()-32, pylon.getZ()-16, pylon.getX()+16, pylon.getY()+32, pylon.getZ()+16));
220- pl.add(MinecraftClient.getInstance().player);
221- for (Entity p : pl) {
222- if (p instanceof LivingEntity){
223- int strMult = 1;
224- if (!(p instanceof PlayerEntity)) {
225- strMult *= 2;
226- }
227- double xdiff = pylon.getX() - p.getX();
228- double zdiff = pylon.getZ() - p.getZ();
229- double dist = Math.sqrt(Math.pow(xdiff, 2) + Math.pow(zdiff, 2));
230- if (dist < 10) {
231- if (xdiff == 0) {
232- xdiff = 0.01;
233- }
234- if (zdiff == 0) {
235- zdiff = 0.01;
236- }
237- double angleX = Math.atan(Math.abs(zdiff) / xdiff);
238- double angleZ = Math.atan(Math.abs(xdiff) / zdiff);
239- double cosX = Math.cos(angleX);
240- double cosZ = Math.cos(angleZ);
241- if (cosX == 0) {
242- cosX = 0.01;
243- }
244- if (cosZ == 0) {
245- cosZ = 0.01;
246- }
247- dist = -dist + 10;
248- p.addVelocity(dist * cosX * strength * strMult * (Math.abs(angleX) / angleX), Math.abs(dist * vStrength * strMult), dist * cosZ * strength * strMult * (Math.abs(angleZ) / angleZ));
249- }
250- }
251- }
252- }
253-
254- pylon.discard();
255- } else {
256- world.playSound(null, user.getX(), user.getY(), user.getZ(), SoundEvents.AMBIENT_UNDERWATER_EXIT, SoundCategory.NEUTRAL, 0.7f, 0.8f / (world.getRandom().nextFloat() * 0.4f + 0.8f));
257- for (int amount = 0; amount < 5; amount++) {
258- MinecraftClient.getInstance().world.addParticle(ParticleTypes.WITCH, user.getX(), user.getY(), user.getZ(), 0.0 + world.getRandom().nextFloat() * 0.4f - 0.2f, 0.2 + world.getRandom().nextFloat() * 0.2f, 0.0 + world.getRandom().nextFloat() * 0.4f - 0.2f);
259- }
260- for (int amount = 0; amount < 45; amount++) {
261- MinecraftClient.getInstance().world.addParticle(ParticleTypes.GLOW_SQUID_INK, user.getX(), user.getY() + 0.2f, user.getZ(), Math.sin(amount*8.0f)*1.0f, 0, Math.cos(amount*8.0f)*1.0f);
262- }
263- PylonEntity pylon = new PylonEntity(ModEntities.PYLON, user.world);
264- pylon.setPlayer(user.getEntityName());
265- pylon.setPos(user.getX(), user.getY() + 1, user.getZ());
266- pylon.refreshPositionAndAngles(user.getX(), user.getY() + 1, user.getZ(), 0, 0);
267- world.spawnEntity(pylon);
268- }
269- }
270- user.getItemCooldownManager().set(this, 60);
271- user.incrementStat(Stats.USED.getOrCreateStat(this));
272- return TypedActionResult.success(itemStack, world.isClient());
273- }
274-
275- */
276183
277184 @ Override
278185 public void appendTooltip (ItemStack itemStack , @ Nullable World world , List <Text > tooltip , TooltipContext context ) {
0 commit comments