Skip to content
This repository was archived by the owner on May 29, 2022. It is now read-only.

Commit

Permalink
Merge branch 'hopper-patch' of https://github.com/crafter23456/NachoS…
Browse files Browse the repository at this point in the history
…pigot2 into hopper-patch

get upstream
  • Loading branch information
crafter23456 committed Feb 20, 2022
2 parents 25c8d15 + 2803645 commit 5ecf91d
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 12 deletions.
2 changes: 1 addition & 1 deletion NachoSpigot-Server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.74.Final</version>
<version>4.1.68.Final</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package dev.cobblesword.nachospigot.commons;

import net.minecraft.server.EnumParticle;
import org.bukkit.Effect;

import java.util.EnumMap;

public class Dictionary {
public static final EnumMap<Effect, EnumParticle> EFFECT_TO_PARTICLE = new EnumMap<>(Effect.class);

static {
String tmp;
for (EnumParticle p : EnumParticle.values()) {
tmp = p.b().replace("_", "");
for (Effect e : Effect.values()) {
// This is pretty much the original code, but we only call it once / effect & matching particle
if (e.getName() != null && e.getName().startsWith(tmp)) {
EFFECT_TO_PARTICLE.put(e, p);
break;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ public synchronized void setSeed(long seed) {
public boolean fromMobSpawner;
public void inactiveTick() { }
// Spigot end
// Migot start

// Migot start
private boolean isInLava;
private int lastLavaCheck = Integer.MIN_VALUE;
// Migot end
Expand Down Expand Up @@ -1075,15 +1075,15 @@ public boolean a(Material material) {
}

public boolean ab() {
// Migot start Check for lava only once per tick
// return this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
int currentTick = MinecraftServer.currentTick;
// Migot start - Check for lava only once per tick
// return this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
int currentTick = MinecraftServer.currentTick;
if (this.lastLavaCheck != currentTick) {
this.lastLavaCheck = currentTick;
this.isInLava = this.world.a(this.getBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
}
return this.isInLava;
// Migot end
// Migot end
}

public void a(float f, float f1, float f2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public class RegionFileCache {
public static final Map<File, RegionFile> a = Maps.newHashMap(); // Spigot - private -> public

// PaperSpigot start
public static /*synchronized*/ RegionFile a(File file, int i, int j) {// Paper 1.13 Backport - remove synchronization
public static /*synchronized*/ RegionFile a(File file, int i, int j) { // Paper - remove synchronization
return a(file, i, j, true);
}
public static /*synchronized*/ RegionFile a(File file, int i, int j, boolean create) {// Paper 1.13 Backport - remove synchronization
public static /*synchronized*/ RegionFile a(File file, int i, int j, boolean create) {// Paper - remove synchronization
// PaperSpigot end
File file1 = new File(file, "region");
File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca");
Expand All @@ -41,7 +41,7 @@ public class RegionFileCache {
}
}

public static /*synchronized*/ void a() {// Paper 1.13 Backport - remove synchronization
public static /*synchronized*/ void a() { // Paper - remove synchronization
Iterator iterator = RegionFileCache.a.values().iterator();

while (iterator.hasNext()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ public boolean unloadWorld(World world, boolean save) {
return false;
}

worlds.remove(world.getName().toLowerCase());
worlds.remove(world.getName().toLowerCase());
console.worlds.remove(handle);

if (save) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public boolean teleport(Location location, TeleportCause cause) {
// entity.world = ((CraftWorld) location.getWorld()).getHandle();
// Spigot end
entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
entity.f(location.getYaw()); // KigPaper - update head yaw to keep consistency with /tp
entity.f(location.getYaw()); // KigPaper - update head yaw to keep consistency with /tp
entity.world.entityJoinedWorld(entity, false); // PaperSpigot - Fix issues with entities not being switched to their new chunk
// entity.setLocation() throws no event, and so cannot be cancelled
return true;
Expand Down

0 comments on commit 5ecf91d

Please sign in to comment.