This repository has been archived by the owner on Jun 1, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
4,073 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>me.gamercoder215</groupId> | ||
<artifactId>mobchip-parent</artifactId> | ||
<version>1.8.1-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>mobchip-1_19_R3</artifactId> | ||
<name>MobChip-1.19.4</name> | ||
|
||
<properties> | ||
<maven.compiler.source>17</maven.compiler.source> | ||
<maven.compiler.target>17</maven.compiler.target> | ||
<java.version>17</java.version> | ||
|
||
<minecraft.version>1.19.4-R0.1-SNAPSHOT</minecraft.version> | ||
</properties> | ||
|
||
<build> | ||
<sourceDirectory>src/main/java</sourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<groupId>net.md-5</groupId> | ||
<artifactId>specialsource-maven-plugin</artifactId> | ||
<version>1.2.4</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>remap</goal> | ||
</goals> | ||
<id>remap-obf</id> | ||
<configuration> | ||
<srgIn>org.spigotmc:minecraft-server:${minecraft.version}:txt:maps-mojang</srgIn> | ||
<reverse>true</reverse> | ||
<remappedDependencies>org.spigotmc:spigot:${minecraft.version}:jar:remapped-mojang</remappedDependencies> | ||
<remappedArtifactAttached>true</remappedArtifactAttached> | ||
<remappedClassifierName>remapped-obf</remappedClassifierName> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>remap</goal> | ||
</goals> | ||
<id>remap-spigot</id> | ||
<configuration> | ||
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile> | ||
<srgIn>org.spigotmc:minecraft-server:${minecraft.version}:csrg:maps-spigot</srgIn> | ||
<remappedDependencies>org.spigotmc:spigot:${minecraft.version}:jar:remapped-obf</remappedDependencies> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.spigotmc</groupId> | ||
<artifactId>spigot</artifactId> | ||
<version>${minecraft.version}</version> | ||
<scope>provided</scope> | ||
<classifier>remapped-mojang</classifier> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>mobchip-abstraction</artifactId> | ||
<version>${project.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>mobchip-1_14_R1</artifactId> | ||
<version>${project.version}</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
|
||
</project> |
56 changes: 56 additions & 0 deletions
56
...1_19_R3/src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R3/Attribute1_19_R3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package me.gamercoder215.mobchip.abstraction.v1_19_R3; | ||
|
||
import me.gamercoder215.mobchip.ai.attribute.Attribute; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.world.entity.ai.attributes.RangedAttribute; | ||
import org.bukkit.NamespacedKey; | ||
import org.bukkit.craftbukkit.v1_19_R3.util.CraftNamespacedKey; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
final class Attribute1_19_R3 extends RangedAttribute implements Attribute { | ||
|
||
private final NamespacedKey key; | ||
private final double defaultV; | ||
private final double min; | ||
private final double max; | ||
|
||
public Attribute1_19_R3(RangedAttribute a) { | ||
super(a.getDescriptionId(), a.getDefaultValue(), a.getMinValue(), a.getMaxValue()); | ||
this.key = BuiltInRegistries.ATTRIBUTE.getKey(a) == null ? NamespacedKey.minecraft(a.getDescriptionId()) : CraftNamespacedKey.fromMinecraft(BuiltInRegistries.ATTRIBUTE.getKey(a)); | ||
this.defaultV = a.getDefaultValue(); | ||
this.min = a.getMinValue(); | ||
this.max = a.getMaxValue(); | ||
} | ||
|
||
public Attribute1_19_R3(NamespacedKey key, double defaultV, double min, double max, boolean clientSide) { | ||
super("attribute.name." + key.getKey().toLowerCase(), defaultV, min, max); | ||
this.key = key; | ||
this.min = min; | ||
this.defaultV = defaultV; | ||
this.max = max; | ||
this.setSyncable(clientSide); | ||
} | ||
|
||
public double getMinValue() { | ||
return this.min; | ||
} | ||
|
||
public double getDefaultValue() { | ||
return this.defaultV; | ||
} | ||
|
||
public double getMaxValue() { | ||
return this.max; | ||
} | ||
|
||
@Override | ||
public boolean isClientSide() { | ||
return isClientSyncable(); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public NamespacedKey getKey() { | ||
return this.key; | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R3/AttributeInstance1_19_R3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package me.gamercoder215.mobchip.abstraction.v1_19_R3; | ||
|
||
import com.google.common.base.Preconditions; | ||
import me.gamercoder215.mobchip.ai.attribute.Attribute; | ||
import me.gamercoder215.mobchip.ai.attribute.AttributeInstance; | ||
import org.bukkit.attribute.AttributeModifier; | ||
import org.bukkit.craftbukkit.v1_19_R3.attribute.CraftAttributeInstance; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Collection; | ||
import java.util.stream.Collectors; | ||
|
||
import static org.bukkit.craftbukkit.v1_19_R3.attribute.CraftAttributeInstance.convert; | ||
|
||
final class AttributeInstance1_19_R3 implements AttributeInstance { | ||
|
||
private final net.minecraft.world.entity.ai.attributes.AttributeInstance handle; | ||
private final Attribute a; | ||
|
||
public AttributeInstance1_19_R3(Attribute a, net.minecraft.world.entity.ai.attributes.AttributeInstance handle) { | ||
this.a = a; | ||
this.handle = handle; | ||
} | ||
|
||
@Override | ||
public @NotNull Attribute getGenericAttribute() { | ||
return this.a; | ||
} | ||
|
||
@Override | ||
public double getBaseValue() { | ||
return handle.getBaseValue(); | ||
} | ||
|
||
@Override | ||
public void setBaseValue(double v) { | ||
handle.setBaseValue(v); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public Collection<AttributeModifier> getModifiers() { | ||
return handle.getModifiers().stream().map(CraftAttributeInstance::convert).collect(Collectors.toSet()); | ||
} | ||
|
||
@Override | ||
public void addModifier(@NotNull AttributeModifier mod) { | ||
Preconditions.checkArgument(mod != null, "modifier"); | ||
handle.addPermanentModifier(convert(mod)); | ||
} | ||
|
||
@Override | ||
public void removeModifier(@NotNull AttributeModifier mod) { | ||
Preconditions.checkArgument(mod != null, "modifier"); | ||
handle.removeModifier(convert(mod)); | ||
} | ||
|
||
@Override | ||
public double getValue() { | ||
return handle.getValue(); | ||
} | ||
|
||
@Override | ||
public double getDefaultValue() { | ||
return handle.getAttribute().getDefaultValue(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...R3/src/main/java/me/gamercoder215/mobchip/abstraction/v1_19_R3/BehaviorResult1_19_R3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package me.gamercoder215.mobchip.abstraction.v1_19_R3; | ||
|
||
import me.gamercoder215.mobchip.ai.behavior.BehaviorResult; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.ai.behavior.BehaviorControl; | ||
import org.bukkit.Bukkit; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
@SuppressWarnings({"unchecked", "rawtypes"}) | ||
final class BehaviorResult1_19_R3 extends BehaviorResult { | ||
private final BehaviorControl b; | ||
private final LivingEntity mob; | ||
private final ServerLevel l; | ||
|
||
public <T extends LivingEntity> BehaviorResult1_19_R3(BehaviorControl<T> b, T mob) { | ||
this.b = b; | ||
this.mob = mob; | ||
this.l = ChipUtil1_19_R3.toNMS(Bukkit.getWorld(mob.level.getWorld().getUID())); | ||
|
||
b.tryStart(l, mob, 0); | ||
} | ||
|
||
@Override | ||
public @NotNull Status getStatus() { | ||
return ChipUtil1_19_R3.fromNMS(b.getStatus()); | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
b.doStop(l, mob, 0); | ||
} | ||
} |
Oops, something went wrong.