Compare commits
2 commits
16ba5471e2
...
056c868f9f
Author | SHA1 | Date | |
---|---|---|---|
056c868f9f | |||
d885b22062 |
4 changed files with 10 additions and 10 deletions
|
@ -7,7 +7,7 @@ minecraft_version=1.20
|
||||||
yarn_mappings=1.20+build.1
|
yarn_mappings=1.20+build.1
|
||||||
loader_version=0.16.10
|
loader_version=0.16.10
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.1.0
|
mod_version=1.1.1
|
||||||
maven_group=arzumify.networked
|
maven_group=arzumify.networked
|
||||||
archives_base_name=networked
|
archives_base_name=networked
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
package arzumify.networked.impl;
|
package arzumify.networked.impl;
|
||||||
|
|
||||||
import arzumify.presence.maths.Vec3i;
|
import arzumify.presence.maths.Vec3i;
|
||||||
|
import arzumify.presence.presences.IntegerPresence;
|
||||||
import arzumify.presence.presences.Presence;
|
import arzumify.presence.presences.Presence;
|
||||||
import arzumify.presence.presences.PresenceProvider;
|
import arzumify.presence.presences.PresenceProvider;
|
||||||
|
|
||||||
public class BasePresence implements PresenceProvider<ModifiablePresence> {
|
public class BasePresence implements PresenceProvider<IntegerPresence> {
|
||||||
public BasePresence(short range, Vec3i... points) {
|
public BasePresence(short range, Vec3i... points) {
|
||||||
this.presence = new ModifiablePresence(range, points);
|
this.presence = new ModifiablePresence(range, points);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final ModifiablePresence presence;
|
public final ModifiablePresence presence;
|
||||||
|
|
||||||
public Presence<ModifiablePresence> presence() {
|
public Presence<IntegerPresence> presence() {
|
||||||
return this.presence;
|
return this.presence;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package arzumify.networked.impl;
|
package arzumify.networked.impl;
|
||||||
|
|
||||||
import arzumify.presence.matchmaker.Channel;
|
import arzumify.presence.matchmaker.Channel;
|
||||||
|
import arzumify.presence.presences.IntegerPresence;
|
||||||
|
|
||||||
public class MatchMaker {
|
public class MatchMaker {
|
||||||
public static arzumify.presence.matchmaker.MatchMaker<ModifiablePresence, BasePresence> matchMaker = new arzumify.presence.matchmaker.MatchMaker<>();
|
public static arzumify.presence.matchmaker.MatchMaker<IntegerPresence, BasePresence> matchMaker = new arzumify.presence.matchmaker.MatchMaker<>();
|
||||||
public static final Channel networkDiscovery = new Channel();
|
public static final Channel networkDiscovery = new Channel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,14 @@ package arzumify.networked.impl;
|
||||||
|
|
||||||
import arzumify.presence.maths.Vec2i;
|
import arzumify.presence.maths.Vec2i;
|
||||||
import arzumify.presence.maths.Vec3i;
|
import arzumify.presence.maths.Vec3i;
|
||||||
|
import arzumify.presence.presences.IntegerPresence;
|
||||||
import arzumify.presence.presences.Presence;
|
import arzumify.presence.presences.Presence;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class ModifiablePresence implements Presence<ModifiablePresence> {
|
public class ModifiablePresence extends IntegerPresence implements Presence<IntegerPresence> {
|
||||||
public ModifiablePresence(short range, Vec3i... basePositions) {
|
public ModifiablePresence(short range, Vec3i... basePositions) {
|
||||||
|
super(range, basePositions);
|
||||||
this.basePositions.addAll(List.of(basePositions));
|
this.basePositions.addAll(List.of(basePositions));
|
||||||
this.range = range;
|
this.range = range;
|
||||||
this.baseChunkPresence = getChunkPresence(this.basePositions);
|
this.baseChunkPresence = getChunkPresence(this.basePositions);
|
||||||
|
@ -35,7 +37,7 @@ public class ModifiablePresence implements Presence<ModifiablePresence> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean Matches(Presence<ModifiablePresence> presence) {
|
public boolean Matches(Presence<IntegerPresence> presence) {
|
||||||
return presence instanceof ModifiablePresence && matches((ModifiablePresence) presence);
|
return presence instanceof ModifiablePresence && matches((ModifiablePresence) presence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,10 +56,6 @@ public class ModifiablePresence implements Presence<ModifiablePresence> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ManhattanDistance(Vec3i a, Vec3i b) {
|
|
||||||
return Math.abs(a.x() - b.x()) + Math.abs(a.y() - b.y()) + Math.abs(a.z() - b.z());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<Short, HashSet<Vec3i>> cachedCollisionShapes = new HashMap<>();
|
private static final Map<Short, HashSet<Vec3i>> cachedCollisionShapes = new HashMap<>();
|
||||||
|
|
||||||
private static HashSet<Vec3i> ComputeCollisionShape(short range, Set<Vec3i> basePositions) {
|
private static HashSet<Vec3i> ComputeCollisionShape(short range, Set<Vec3i> basePositions) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue