Compare commits
2 Commits
6bec816f4c
...
a35dda60d3
Author | SHA1 | Date |
---|---|---|
|
a35dda60d3 | |
|
a364cbb128 |
|
@ -1 +1 @@
|
|||
vmodaddon
|
||||
vmodextras
|
|
@ -0,0 +1,7 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<ScalaCodeStyleSettings>
|
||||
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||
</ScalaCodeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
|
@ -0,0 +1,5 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
|
@ -9,7 +9,7 @@
|
|||
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.8.5/6d1c8bf4c28e697f472a83bd6add76ec4951734/mixin-0.8.5-processor.jar" />
|
||||
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.20/18bcea7d5df4d49227b4a0743a536208ce4825bb/lombok-1.18.20.jar" />
|
||||
</processorPath>
|
||||
<module name="vmodaddon.main" />
|
||||
<module name="vmodextras.main" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel target="17" />
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/vmodaddon.main.iml" filepath="$PROJECT_DIR$/.idea/modules/vmodaddon.main.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/vmodaddon.test.iml" filepath="$PROJECT_DIR$/.idea/modules/vmodaddon.test.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/vmodextras.main.iml" filepath="$PROJECT_DIR$/.idea/modules/vmodextras.main.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/vmodextras.test.iml" filepath="$PROJECT_DIR$/.idea/modules/vmodextras.test.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -11,17 +11,12 @@
|
|||
<autoDetectTypes>
|
||||
<platformType>FORGE</platformType>
|
||||
<platformType>MIXIN</platformType>
|
||||
<platformType>MCP</platformType>
|
||||
</autoDetectTypes>
|
||||
<projectReimportVersion>1</projectReimportVersion>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="McpModuleSettings">
|
||||
<option name="mappingFile" value="$MODULE_DIR$/../../build/createMcpToSrg/output.tsrg" />
|
||||
<option name="mcpVersion" value="official_1.20.1" />
|
||||
<option name="minecraftVersion" value="1.20.1" />
|
||||
<option name="platformVersion" value="47.4.1" />
|
||||
<option name="srgType" value="TSRG" />
|
||||
<option name="srgType" value="SRG" />
|
||||
</component>
|
||||
</module>
|
|
@ -6,17 +6,12 @@
|
|||
<autoDetectTypes>
|
||||
<platformType>FORGE</platformType>
|
||||
<platformType>MIXIN</platformType>
|
||||
<platformType>MCP</platformType>
|
||||
</autoDetectTypes>
|
||||
<projectReimportVersion>1</projectReimportVersion>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="McpModuleSettings">
|
||||
<option name="mappingFile" value="$MODULE_DIR$/../../build/createMcpToSrg/output.tsrg" />
|
||||
<option name="mcpVersion" value="official_1.20.1" />
|
||||
<option name="minecraftVersion" value="1.20.1" />
|
||||
<option name="platformVersion" value="47.4.1" />
|
||||
<option name="srgType" value="TSRG" />
|
||||
<option name="srgType" value="SRG" />
|
||||
</component>
|
||||
</module>
|
|
@ -180,6 +180,8 @@ dependencies {
|
|||
implementation(fg.deobf(files("./libs/trackwork-1.20.1-1.1.1b.jar")))
|
||||
implementation(fg.deobf("org.valkyrienskies:valkyrienskies-120:2.3.0-beta.7"))
|
||||
|
||||
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.14.0'
|
||||
|
||||
implementation 'net.minecraftforge:modlauncher:10.1.1'
|
||||
implementation 'net.minecraftforge:forgespi:7.1.0'
|
||||
|
||||
|
|
|
@ -5,24 +5,10 @@ minecraft_version_range=[1.20.1,1.21)
|
|||
forge_version=47.4.1
|
||||
forge_version_range=[47,)
|
||||
loader_version_range=[47,)
|
||||
# The mapping channel to use for mappings.
|
||||
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
|
||||
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
|
||||
#
|
||||
# | Channel | Version | |
|
||||
# |-----------|----------------------|--------------------------------------------------------------------------------|
|
||||
# | official | MCVersion | Official field/method names from Mojang mapping files |
|
||||
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
|
||||
#
|
||||
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
|
||||
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
#
|
||||
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
|
||||
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
|
||||
mapping_channel=official
|
||||
mapping_version=1.20.1
|
||||
mod_id=vmodaddon
|
||||
mod_name=VModAddon
|
||||
mod_id=vmodextras
|
||||
mod_name=VModExtras
|
||||
mod_license=MIT
|
||||
mod_version=1.0-SNAPSHOT
|
||||
mod_group_id=space.eptaproject
|
||||
|
|
|
@ -12,4 +12,4 @@ plugins {
|
|||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
||||
}
|
||||
|
||||
rootProject.name = 'vmodaddon'
|
||||
rootProject.name = 'vmodextras'
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package space.eptaproject.vmodaddon;
|
||||
|
||||
import space.eptaproject.vmodaddon.mixins.PhysicsTrackControllerAccessor;
|
||||
|
||||
public interface IPhysicsTrackController extends PhysicsTrackControllerAccessor {
|
||||
void SetRawDamperCoefficient(float delta);
|
||||
float GetRawDamperCoefficient();
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package space.eptaproject.vmodaddon;
|
||||
|
||||
import space.eptaproject.vmodaddon.mixins.SimpleWheelControllerAccessor;
|
||||
|
||||
public interface ISimpleWheelController extends SimpleWheelControllerAccessor {
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
package space.eptaproject.vmodaddon.block;
|
||||
|
||||
import edn.stratodonut.trackwork.tracks.forces.PhysicsTrackController;
|
||||
import edn.stratodonut.trackwork.tracks.forces.SimpleWheelController;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.joml.Vector3d;
|
||||
import org.joml.Vector3dc;
|
||||
import org.valkyrienskies.core.api.ships.ServerShip;
|
||||
import org.valkyrienskies.mod.common.VSGameUtilsKt;
|
||||
import space.eptaproject.vmodaddon.IPhysicsTrackController;
|
||||
import space.eptaproject.vmodaddon.ISimpleWheelController;
|
||||
import space.eptaproject.vmodaddon.Vmodaddon;
|
||||
|
||||
public class TrackBackupBlockEntity extends BlockEntity {
|
||||
public TrackBackupBlockEntity(BlockPos p_155229_, BlockState p_155230_) {
|
||||
super(Vmodaddon.MY_BLOCK_ENTITY.get(), p_155229_, p_155230_);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveAdditional(CompoundTag tag) {
|
||||
super.saveAdditional(tag);
|
||||
ServerShip ship = (ServerShip) VSGameUtilsKt.getShipObjectManagingPos(this.level, getBlockPos());
|
||||
if (ship != null) {
|
||||
{
|
||||
PhysicsTrackController physicsTrackController = ship.getAttachment(PhysicsTrackController.class);
|
||||
IPhysicsTrackController controller = (IPhysicsTrackController) physicsTrackController;
|
||||
if (physicsTrackController != null) {
|
||||
CompoundTag PhysicsTrackControllerTag = new CompoundTag();
|
||||
|
||||
PhysicsTrackControllerTag.putFloat("SuspensionStiffness", controller.getSuspensionStiffness());
|
||||
{
|
||||
CompoundTag suspensionAdjust = new CompoundTag();
|
||||
|
||||
Vector3dc vec = controller.getSuspensionAdjust();
|
||||
|
||||
suspensionAdjust.putDouble("x", vec.x());
|
||||
suspensionAdjust.putDouble("y", vec.y());
|
||||
suspensionAdjust.putDouble("z", vec.z());
|
||||
|
||||
PhysicsTrackControllerTag.put("suspensionAdjust", suspensionAdjust);
|
||||
}
|
||||
|
||||
tag.put("PhysicsTrackController", PhysicsTrackControllerTag);
|
||||
}
|
||||
}
|
||||
{
|
||||
SimpleWheelController simpleWheelController = ship.getAttachment(SimpleWheelController.class);
|
||||
ISimpleWheelController controller = (ISimpleWheelController) simpleWheelController;
|
||||
if (simpleWheelController != null) {
|
||||
CompoundTag SimpleWheelControllerTag = new CompoundTag();
|
||||
|
||||
SimpleWheelControllerTag.putFloat("SuspensionStiffness", controller.getSuspensionStiffness());
|
||||
{
|
||||
CompoundTag suspensionAdjust = new CompoundTag();
|
||||
|
||||
Vector3dc vec = controller.getSuspensionAdjust();
|
||||
|
||||
suspensionAdjust.putDouble("x", vec.x());
|
||||
suspensionAdjust.putDouble("y", vec.y());
|
||||
suspensionAdjust.putDouble("z", vec.z());
|
||||
|
||||
SimpleWheelControllerTag.put("suspensionAdjust", suspensionAdjust);
|
||||
}
|
||||
|
||||
tag.put("SimpleWheelController", SimpleWheelControllerTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(CompoundTag tag) {
|
||||
super.load(tag);
|
||||
|
||||
ServerShip ship = (ServerShip) VSGameUtilsKt.getShipObjectManagingPos(this.level, getBlockPos());
|
||||
if (ship != null) {
|
||||
if (tag.contains("SimpleWheelController")) {
|
||||
CompoundTag L = tag.getCompound("SimpleWheelController");
|
||||
SimpleWheelController controller2 = SimpleWheelController.getOrCreate(ship);
|
||||
if (L.contains("SuspensionStiffness")) {
|
||||
((ISimpleWheelController) controller2).setSuspensionStiffness(L.getFloat("SuspensionStiffness"));
|
||||
}
|
||||
if (L.contains("suspensionAdjust")) {
|
||||
CompoundTag suspensionAdjust = L.getCompound("suspensionAdjust");
|
||||
|
||||
((ISimpleWheelController) controller2).setSuspensionAdjust(new Vector3d(new Vector3d(suspensionAdjust.getDouble("x"), suspensionAdjust.getDouble("y"), suspensionAdjust.getDouble("z"))));
|
||||
}
|
||||
}
|
||||
|
||||
if (tag.contains("PhysicsTrackController")) {
|
||||
CompoundTag L = tag.getCompound("PhysicsTrackController");
|
||||
PhysicsTrackController controller = PhysicsTrackController.getOrCreate(ship);
|
||||
if (L.contains("SuspensionStiffness")) {
|
||||
((IPhysicsTrackController) controller).setSuspensionStiffness(L.getFloat("SuspensionStiffness"));
|
||||
}
|
||||
if (L.contains("suspensionAdjust")) {
|
||||
CompoundTag suspensionAdjust = L.getCompound("suspensionAdjust");
|
||||
|
||||
|
||||
((IPhysicsTrackController) controller).setSuspensionAdjust(new Vector3d(suspensionAdjust.getDouble("x"), suspensionAdjust.getDouble("y"), suspensionAdjust.getDouble("z")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package space.eptaproject.vmodaddon.mixin;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface A {
|
||||
String[] value();
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package space.eptaproject.vmodaddon.mixin;
|
||||
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
public interface ITransformer {
|
||||
void transform(String targetClassName, ClassNode classNode, String mixinClassName, IMixinInfo mixinInfo);
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package space.eptaproject.vmodaddon.mixin;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class InstanceHolder<T> {
|
||||
private final Map<Class<? extends T>, T> instances = new Object2ObjectArrayMap<>();
|
||||
|
||||
public InstanceHolder() {
|
||||
|
||||
}
|
||||
public T get(String cls) {
|
||||
try {
|
||||
return get((Class<? extends T>) Class.forName(cls));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public T get(Class<? extends T> cls) {
|
||||
if (instances.containsKey(cls)) {
|
||||
return instances.get(cls);
|
||||
}
|
||||
|
||||
try {
|
||||
T instance = cls.getDeclaredConstructor().newInstance();
|
||||
instances.put(cls, instance);
|
||||
return instance;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package space.eptaproject.vmodaddon.mixin;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.*;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class KotlinOptimizationTransformer implements ITransformer {
|
||||
|
||||
|
||||
@Override
|
||||
public void transform(String targetClassName, ClassNode classNode, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
for (MethodNode method : classNode.methods) {
|
||||
ListIterator<AbstractInsnNode> it = method.instructions.iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
AbstractInsnNode insn = it.next();
|
||||
|
||||
if (insn.getOpcode() == Opcodes.INVOKESTATIC &&
|
||||
insn instanceof MethodInsnNode methodInsn &&
|
||||
methodInsn.owner.equals("kotlin/jvm/internal/Intrinsics") &&
|
||||
(methodInsn.name.equals("checkParameterIsNotNull") || methodInsn.name.equals("checkNotNullParameter") || methodInsn.name.equals("checkNotNullExpressionValue")) &&
|
||||
methodInsn.desc.equals("(Ljava/lang/Object;Ljava/lang/String;)V")) {
|
||||
|
||||
AbstractInsnNode arg2Insn = methodInsn.getPrevious();
|
||||
AbstractInsnNode arg1Insn = arg2Insn != null ? arg2Insn.getPrevious() : null;
|
||||
|
||||
method.instructions.remove(arg1Insn);
|
||||
method.instructions.remove(arg2Insn);
|
||||
method.instructions.remove(insn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
package space.eptaproject.vmodaddon.mixin;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
import org.objectweb.asm.tree.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
public class MixinPlugin implements IMixinConfigPlugin {
|
||||
public InstanceHolder<ITransformer> transformerInstanceHolder = new InstanceHolder<>();
|
||||
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefMapperConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMixins() {
|
||||
return List.of(
|
||||
"BlockPaletteHashMapV1Mixin",
|
||||
"PhysicsTrackControllerAccessor",
|
||||
"PhysicsTrackControllerMixin",
|
||||
"SimpleWheelControllerAccessor",
|
||||
"SimpleWheelControllerMixin"
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postApply(String targetClassName, ClassNode classNode, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
String annotationDesc = "Lspace/eptaproject/vmodaddon/mixin/A;";
|
||||
|
||||
if (classNode.visibleAnnotations == null) {
|
||||
classNode.visibleAnnotations = new ArrayList<>();
|
||||
}
|
||||
|
||||
AnnotationNode existing = null;
|
||||
for (AnnotationNode ann : classNode.visibleAnnotations) {
|
||||
if (Objects.equals(ann.desc, annotationDesc)) {
|
||||
existing = ann;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (existing != null) {
|
||||
List<Object> values = existing.values;
|
||||
for (int i = 0; i < values.size(); i += 2) {
|
||||
String key = (String) values.get(i);
|
||||
if (key.equals("value")) {
|
||||
List<String> list = (List<String>) values.get(i + 1);
|
||||
if (!list.contains(mixinClassName)) {
|
||||
list.add(mixinClassName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
values.add("value");
|
||||
values.add(new ArrayList<>(List.of(mixinClassName)));
|
||||
} else {
|
||||
AnnotationNode newAnnotation = new AnnotationNode(annotationDesc);
|
||||
newAnnotation.values = new ArrayList<>();
|
||||
newAnnotation.values.add("value");
|
||||
newAnnotation.values.add(new ArrayList<>(List.of(mixinClassName)));
|
||||
classNode.visibleAnnotations.add(newAnnotation);
|
||||
}
|
||||
|
||||
//transformerInstanceHolder.get(KotlinOptimizationTransformer.class).transform(targetClassName, classNode, mixinClassName, mixinInfo);
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package space.eptaproject.vmodaddon.mixin;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Transformers {
|
||||
Class<? extends ITransformer>[] transformers();
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package space.eptaproject.vmodaddon;
|
||||
package space.eptaproject.vmodextras;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectImmutableList;
|
||||
|
@ -16,6 +16,7 @@ public class Config {
|
|||
public static final ForgeConfigSpec.ConfigValue<String> RESOURCE_LOCATION;
|
||||
|
||||
public static final ForgeConfigSpec.ConfigValue<Integer> Suspension_Stiffness_LIMIT;
|
||||
public static final ForgeConfigSpec.ConfigValue<Double> Suspension_Stiffness_delta;
|
||||
|
||||
public static List<ResourceLocation> parsedList = new ObjectArrayList<>();
|
||||
private static List<Map.Entry<Integer, ResourceLocation>> ITEM = new ObjectImmutableList<>(new ArrayList<>());
|
||||
|
@ -62,6 +63,11 @@ public class Config {
|
|||
.comment("track suspension stiffness")
|
||||
.defineInRange("SuspensionStiffness", 4, 1, 20);
|
||||
|
||||
Suspension_Stiffness_delta = builder
|
||||
.comment("track suspension stiffness delta")
|
||||
.defineInRange("suspension_stiffness_delta", 1d, 0.10d, 1d);
|
||||
|
||||
|
||||
builder.pop();
|
||||
COMMON_CONFIG = builder.build();
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package space.eptaproject.vmodaddon;
|
||||
package space.eptaproject.vmodextras;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Block;
|
|
@ -1,4 +1,4 @@
|
|||
package space.eptaproject.vmodaddon;
|
||||
package space.eptaproject.vmodextras;
|
||||
|
||||
import lombok.ToString;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
@ToString
|
||||
public class Validator implements IValidator {
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("Validator");
|
||||
public static ResourceLocation RB = ResourceLocation.fromNamespaceAndPath(Vmodaddon.MODID, "example_block");
|
||||
public static ResourceLocation RB = ResourceLocation.fromNamespaceAndPath(VmodExtras.MODID, "example_block");
|
||||
|
||||
public Validator() {
|
||||
|
|
@ -1,6 +1,10 @@
|
|||
package space.eptaproject.vmodaddon;
|
||||
package space.eptaproject.vmodextras;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
@ -16,18 +20,21 @@ import net.minecraftforge.fml.config.ModConfig;
|
|||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.minecraftforge.registries.*;
|
||||
import org.slf4j.Logger;
|
||||
import space.eptaproject.vmodaddon.block.CompactBackupBlock;
|
||||
import space.eptaproject.vmodaddon.block.CompactBackupBlockEntity;
|
||||
import space.eptaproject.vmodaddon.block.TrackBackupBlock;
|
||||
import space.eptaproject.vmodaddon.block.TrackBackupBlockEntity;
|
||||
import space.eptaproject.vmodaddon.util.ModRegistry;
|
||||
import space.eptaproject.vmodextras.block.CompactBackupBlock;
|
||||
import space.eptaproject.vmodextras.block.CompactBackupBlockEntity;
|
||||
import space.eptaproject.vmodextras.block.TrackBackupBlock;
|
||||
import space.eptaproject.vmodextras.block.TrackBackupBlockEntity;
|
||||
import space.eptaproject.vmodextras.util.ModRegistry;
|
||||
|
||||
@Mod(Vmodaddon.MODID)
|
||||
public class Vmodaddon {
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Map;
|
||||
|
||||
public static final String MODID = "vmodaddon";
|
||||
@Mod(VmodExtras.MODID)
|
||||
public class VmodExtras {
|
||||
public static final String MODID = "vmodextras";
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
|
@ -51,7 +58,7 @@ public class Vmodaddon {
|
|||
static {
|
||||
REGISTRY = new ModRegistry(MODID);
|
||||
|
||||
TRAK_BUK = REGISTRY.BLOCKS.register("track_b", () -> new TrackBackupBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE)));
|
||||
TRAK_BUK = REGISTRY.BLOCKS.register("track_backup", () -> new TrackBackupBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE)));
|
||||
SHIP_VOID_BLOCK = REGISTRY.BLOCKS.register("ship_void", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE)));
|
||||
COMPACT_BACKUP = REGISTRY.BLOCKS.register("compact_backup", () -> new CompactBackupBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE)));
|
||||
|
||||
|
@ -60,14 +67,14 @@ public class Vmodaddon {
|
|||
|
||||
EXAMPLE_TAB = REGISTRY.TabBuilder()
|
||||
.push((registry) -> {
|
||||
MY_BLOCK_ITEM = registry.register("track_b", () -> new BlockItem(TRAK_BUK.get(), new Item.Properties()));
|
||||
MY_BLOCK_ITEM = registry.register("track_backup", () -> new BlockItem(TRAK_BUK.get(), new Item.Properties()));
|
||||
SHIP_VOID_ITEM = registry.register("ship_void", () -> new BlockItem(SHIP_VOID_BLOCK.get(), new Item.Properties()));
|
||||
COMPACT_BACKUP_ITEM = registry.register("compact_backup", () -> new BlockItem(COMPACT_BACKUP.get(), new Item.Properties()));
|
||||
})
|
||||
.build("vmodaddon", Items.BEDROCK.getDefaultInstance());
|
||||
.build("vmodetras", Items.BEDROCK.getDefaultInstance());
|
||||
}
|
||||
|
||||
public Vmodaddon() {
|
||||
public VmodExtras() {
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
modEventBus.addListener(this::commonSetup);
|
|
@ -1,9 +1,9 @@
|
|||
package space.eptaproject.vmodaddon.block;
|
||||
package space.eptaproject.vmodextras.block;
|
||||
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import space.eptaproject.vmodaddon.Vmodaddon;
|
||||
import space.eptaproject.vmodextras.VmodExtras;
|
||||
|
||||
public class CompactBackupBlock extends Block implements IBE<CompactBackupBlockEntity> {
|
||||
|
||||
|
@ -13,7 +13,7 @@ public class CompactBackupBlock extends Block implements IBE<CompactBackupBlockE
|
|||
|
||||
@Override
|
||||
public BlockEntityType<? extends CompactBackupBlockEntity> getBlockEntityType() {
|
||||
return Vmodaddon.COMPACT_BACKUP_BLOCK_ENTITY.get();
|
||||
return VmodExtras.COMPACT_BACKUP_BLOCK_ENTITY.get();
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,4 +1,4 @@
|
|||
package space.eptaproject.vmodaddon.block;
|
||||
package space.eptaproject.vmodextras.block;
|
||||
|
||||
import edn.stratodonut.drivebywire.wire.ShipWireNetworkManager;
|
||||
import edn.stratodonut.trackwork.tracks.forces.PhysicsTrackController;
|
||||
|
@ -13,16 +13,16 @@ import org.joml.Vector3d;
|
|||
import org.joml.Vector3dc;
|
||||
import org.valkyrienskies.core.api.ships.ServerShip;
|
||||
import org.valkyrienskies.mod.common.VSGameUtilsKt;
|
||||
import space.eptaproject.vmodaddon.IPhysicsTrackController;
|
||||
import space.eptaproject.vmodaddon.ISimpleWheelController;
|
||||
import space.eptaproject.vmodaddon.Vmodaddon;
|
||||
import space.eptaproject.vmodextras.trackwork.IPhysicsTrackController;
|
||||
import space.eptaproject.vmodextras.trackwork.ISimpleWheelController;
|
||||
import space.eptaproject.vmodextras.VmodExtras;
|
||||
|
||||
|
||||
public class CompactBackupBlockEntity extends BlockEntity {
|
||||
private CompoundTag pendingBackupData;
|
||||
|
||||
public CompactBackupBlockEntity(BlockPos p_155229_, BlockState p_155230_) {
|
||||
super(Vmodaddon.COMPACT_BACKUP_BLOCK_ENTITY.get(), p_155229_, p_155230_);
|
||||
super(VmodExtras.COMPACT_BACKUP_BLOCK_ENTITY.get(), p_155229_, p_155230_);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,9 +1,9 @@
|
|||
package space.eptaproject.vmodaddon.block;
|
||||
package space.eptaproject.vmodextras.block;
|
||||
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import space.eptaproject.vmodaddon.Vmodaddon;
|
||||
import space.eptaproject.vmodextras.VmodExtras;
|
||||
|
||||
public class TrackBackupBlock extends Block implements IBE<TrackBackupBlockEntity> {
|
||||
|
||||
|
@ -13,7 +13,7 @@ public class TrackBackupBlock extends Block implements IBE<TrackBackupBlockEntit
|
|||
|
||||
@Override
|
||||
public BlockEntityType<? extends TrackBackupBlockEntity> getBlockEntityType() {
|
||||
return Vmodaddon.MY_BLOCK_ENTITY.get();
|
||||
return VmodExtras.MY_BLOCK_ENTITY.get();
|
||||
}
|
||||
|
||||
@Override
|
|
@ -0,0 +1,115 @@
|
|||
package space.eptaproject.vmodextras.block;
|
||||
|
||||
import edn.stratodonut.trackwork.tracks.forces.PhysicsTrackController;
|
||||
import edn.stratodonut.trackwork.tracks.forces.SimpleWheelController;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.valkyrienskies.core.api.ships.ServerShip;
|
||||
import org.valkyrienskies.mod.common.VSGameUtilsKt;
|
||||
import space.eptaproject.vmodextras.trackwork.IPhysicsTrackController;
|
||||
import space.eptaproject.vmodextras.trackwork.ISimpleWheelController;
|
||||
import space.eptaproject.vmodextras.VmodExtras;
|
||||
import space.eptaproject.vmodextras.util.IBlockEntityClear;
|
||||
|
||||
public class TrackBackupBlockEntity extends BlockEntity implements IBlockEntityClear {
|
||||
public TrackBackupBlockEntity(BlockPos p_155229_, BlockState p_155230_) {
|
||||
super(VmodExtras.MY_BLOCK_ENTITY.get(), p_155229_, p_155230_);
|
||||
}
|
||||
|
||||
public CompoundTag tag = new CompoundTag();
|
||||
|
||||
@Override
|
||||
public boolean clear() {
|
||||
try {
|
||||
CompoundTag local = tag.copy();
|
||||
if (local.contains("SimpleWheelController")) {
|
||||
CompoundTag SimpleWheelControllerTag = new CompoundTag();
|
||||
|
||||
SimpleWheelControllerTag.putFloat("SuspensionStiffness", 1);
|
||||
{
|
||||
CompoundTag suspensionAdjust = new CompoundTag();
|
||||
|
||||
suspensionAdjust.putDouble("x", 0);
|
||||
suspensionAdjust.putDouble("y", 1);
|
||||
suspensionAdjust.putDouble("z", 0);
|
||||
|
||||
SimpleWheelControllerTag.put("suspensionAdjust", suspensionAdjust);
|
||||
}
|
||||
|
||||
tag.put("SimpleWheelController", SimpleWheelControllerTag);
|
||||
}
|
||||
|
||||
if (local.contains("PhysicsTrackController")) {
|
||||
CompoundTag PhysicsTrackControllerTag = new CompoundTag();
|
||||
|
||||
PhysicsTrackControllerTag.putFloat("SuspensionStiffness", 1);
|
||||
{
|
||||
CompoundTag suspensionAdjust = new CompoundTag();
|
||||
|
||||
|
||||
suspensionAdjust.putDouble("x", 0);
|
||||
suspensionAdjust.putDouble("y", 1);
|
||||
suspensionAdjust.putDouble("z", 0);
|
||||
|
||||
PhysicsTrackControllerTag.put("suspensionAdjust", suspensionAdjust);
|
||||
}
|
||||
|
||||
tag.put("PhysicsTrackController", PhysicsTrackControllerTag);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void saveAdditional(CompoundTag tag) {
|
||||
this.tag = tag;
|
||||
super.saveAdditional(tag);
|
||||
ServerShip ship = (ServerShip) VSGameUtilsKt.getShipObjectManagingPos(this.level, getBlockPos());
|
||||
if (ship != null) {
|
||||
{
|
||||
PhysicsTrackController physicsTrackController = ship.getAttachment(PhysicsTrackController.class);
|
||||
if (physicsTrackController != null) {
|
||||
IPhysicsTrackController controller = (IPhysicsTrackController) physicsTrackController;
|
||||
CompoundTag local = new CompoundTag();
|
||||
|
||||
controller.encode(local);
|
||||
|
||||
tag.put("PhysicsTrackController", local);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
SimpleWheelController simpleWheelController = ship.getAttachment(SimpleWheelController.class);
|
||||
if (simpleWheelController != null) {
|
||||
ISimpleWheelController controller = (ISimpleWheelController) simpleWheelController;
|
||||
CompoundTag local = new CompoundTag();
|
||||
|
||||
controller.encode(local);
|
||||
|
||||
tag.put("SimpleWheelController", local);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(CompoundTag tag) {
|
||||
this.tag = tag;
|
||||
super.load(tag);
|
||||
ServerShip ship = (ServerShip) VSGameUtilsKt.getShipObjectManagingPos(this.level, getBlockPos());
|
||||
if (ship != null) {
|
||||
if (tag.contains("SimpleWheelController", Tag.TAG_COMPOUND)) {
|
||||
((ISimpleWheelController) SimpleWheelController.getOrCreate(ship)).decode(tag.getCompound("SimpleWheelController"));
|
||||
}
|
||||
|
||||
if (tag.contains("PhysicsTrackController", Tag.TAG_COMPOUND)) {
|
||||
((IPhysicsTrackController) PhysicsTrackController.getOrCreate(ship)).decode(tag.getCompound("PhysicsTrackController"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package space.eptaproject.vmodextras.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
import org.objectweb.asm.tree.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class MixinPlugin implements IMixinConfigPlugin {
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefMapperConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMixins() {
|
||||
return List.of(
|
||||
"BlockPaletteHashMapV1Mixin",
|
||||
"PhysicsTrackControllerAccessor",
|
||||
"PhysicsTrackControllerMixin",
|
||||
"SimpleWheelControllerAccessor",
|
||||
"SimpleWheelControllerMixin"
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postApply(String targetClassName, ClassNode classNode, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
@ApiStatus.Experimental
|
||||
package space.eptaproject.vmodaddon.mixin;
|
||||
package space.eptaproject.vmodextras.mixin;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
|
@ -1,4 +1,4 @@
|
|||
package space.eptaproject.vmodaddon.mixins;
|
||||
package space.eptaproject.vmodextras.mixins;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.CrudeIncrementalIntIdentityHashBiMap;
|
||||
|
@ -13,13 +13,10 @@ import org.spongepowered.asm.mixin.Unique;
|
|||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import space.eptaproject.vmodaddon.IValidator;
|
||||
import space.eptaproject.vmodaddon.Validator;
|
||||
import space.eptaproject.vmodaddon.mixin.KotlinOptimizationTransformer;
|
||||
import space.eptaproject.vmodaddon.mixin.Transformers;
|
||||
import space.eptaproject.vmodextras.IValidator;
|
||||
import space.eptaproject.vmodextras.Validator;
|
||||
|
||||
@Mixin(BlockPaletteHashMapV1.class)
|
||||
@Transformers(transformers = {KotlinOptimizationTransformer.class})
|
||||
public class BlockPaletteHashMapV1Mixin {
|
||||
@Unique
|
||||
public final IValidator validator = new Validator();
|
|
@ -1,4 +1,4 @@
|
|||
package space.eptaproject.vmodaddon.mixins;
|
||||
package space.eptaproject.vmodextras.mixins;
|
||||
|
||||
import edn.stratodonut.trackwork.tracks.forces.PhysicsTrackController;
|
||||
import org.joml.Vector3dc;
|
|
@ -1,31 +1,19 @@
|
|||
package space.eptaproject.vmodaddon.mixins;
|
||||
package space.eptaproject.vmodextras.mixins;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import edn.stratodonut.trackwork.tracks.forces.PhysicsTrackController;
|
||||
import org.joml.Math;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import space.eptaproject.vmodaddon.Config;
|
||||
import space.eptaproject.vmodaddon.IPhysicsTrackController;
|
||||
import space.eptaproject.vmodextras.Config;
|
||||
import space.eptaproject.vmodextras.trackwork.IPhysicsTrackController;
|
||||
|
||||
@Mixin(PhysicsTrackController.class)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public abstract class PhysicsTrackControllerMixin implements IPhysicsTrackController {
|
||||
@Shadow private volatile float suspensionStiffness;
|
||||
|
||||
@Unique
|
||||
private volatile float damperCoefficient = 0;
|
||||
|
||||
@Override
|
||||
public void SetRawDamperCoefficient(float delta) {
|
||||
this.damperCoefficient = delta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float GetRawDamperCoefficient() {
|
||||
return damperCoefficient;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @reason
|
|
@ -1,4 +1,4 @@
|
|||
package space.eptaproject.vmodaddon.mixins;
|
||||
package space.eptaproject.vmodextras.mixins;
|
||||
|
||||
import edn.stratodonut.trackwork.tracks.forces.SimpleWheelController;
|
||||
import org.joml.Vector3dc;
|
|
@ -1,17 +1,23 @@
|
|||
package space.eptaproject.vmodaddon.mixins;
|
||||
package space.eptaproject.vmodextras.mixins;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import edn.stratodonut.trackwork.tracks.forces.SimpleWheelController;
|
||||
import org.joml.Math;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import space.eptaproject.vmodaddon.Config;
|
||||
import space.eptaproject.vmodaddon.ISimpleWheelController;
|
||||
import space.eptaproject.vmodextras.Config;
|
||||
import space.eptaproject.vmodextras.trackwork.ISimpleWheelController;
|
||||
|
||||
@Mixin(SimpleWheelController.class)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public abstract class SimpleWheelControllerMixin implements ISimpleWheelController {
|
||||
@Shadow private volatile float suspensionStiffness;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @reason
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
public final float setDamperCoefficient(float delta) {
|
||||
this.suspensionStiffness = Math.clamp(1, Config.Suspension_Stiffness_LIMIT.get(), this.suspensionStiffness + delta);
|
|
@ -0,0 +1,9 @@
|
|||
package space.eptaproject.vmodextras.mixins;
|
||||
|
||||
import edn.stratodonut.trackwork.items.TrackToolkit;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(TrackToolkit.class)
|
||||
public class TrackToolkitMixin {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package space.eptaproject.vmodextras.trackwork;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import org.joml.Vector3d;
|
||||
import org.joml.Vector3dc;
|
||||
|
||||
public interface IController {
|
||||
float getSuspensionStiffness();
|
||||
void setSuspensionStiffness(float val);
|
||||
Vector3dc getSuspensionAdjust();
|
||||
void setSuspensionAdjust(Vector3dc vector3d);
|
||||
|
||||
default void encode(CompoundTag root) {
|
||||
root.putFloat("SuspensionStiffness", this.getSuspensionStiffness());
|
||||
{
|
||||
CompoundTag suspensionAdjust = new CompoundTag();
|
||||
|
||||
Vector3dc vec = this.getSuspensionAdjust();
|
||||
|
||||
suspensionAdjust.putDouble("x", vec.x());
|
||||
suspensionAdjust.putDouble("y", vec.y());
|
||||
suspensionAdjust.putDouble("z", vec.z());
|
||||
|
||||
root.put("suspensionAdjust", suspensionAdjust);
|
||||
}
|
||||
}
|
||||
|
||||
default void decode(CompoundTag root) {
|
||||
if (root.contains("SuspensionStiffness", Tag.TAG_FLOAT)) {
|
||||
this.setSuspensionStiffness(root.getFloat("SuspensionStiffness"));
|
||||
}
|
||||
|
||||
if (root.contains("suspensionAdjust", Tag.TAG_COMPOUND)) {
|
||||
CompoundTag sus = root.getCompound("suspensionAdjust");
|
||||
this.setSuspensionAdjust(new Vector3d(sus.getDouble("x"), sus.getDouble("y"), sus.getDouble("z")));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package space.eptaproject.vmodextras.trackwork;
|
||||
|
||||
import space.eptaproject.vmodextras.mixins.PhysicsTrackControllerAccessor;
|
||||
|
||||
public interface IPhysicsTrackController extends PhysicsTrackControllerAccessor, IController {
|
||||
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package space.eptaproject.vmodextras.trackwork;
|
||||
|
||||
import space.eptaproject.vmodextras.mixins.SimpleWheelControllerAccessor;
|
||||
|
||||
public interface ISimpleWheelController extends SimpleWheelControllerAccessor, IController {
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package space.eptaproject.vmodextras.trackwork.item;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
public class ToolKit extends Item {
|
||||
public ToolKit(Item.Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) {
|
||||
Player player = context.getPlayer();
|
||||
if (player != null && player.mayBuild()) {
|
||||
Level level = context.getLevel();
|
||||
BlockPos pos = context.getClickedPos();
|
||||
CompoundTag nbt = stack.getTag();
|
||||
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Mode {
|
||||
CLEAR
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package space.eptaproject.vmodextras.util;
|
||||
|
||||
public interface IBlockEntityClear {
|
||||
boolean clear();
|
||||
default boolean reset() {
|
||||
return clear();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package space.eptaproject.vmodaddon.util;
|
||||
package space.eptaproject.vmodextras.util;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
||||
import lombok.Getter;
|
|
@ -1,63 +1,21 @@
|
|||
# This is an example mods.toml file. It contains the data relating to the loading mods.
|
||||
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
|
||||
# The overall format is standard TOML format, v0.5.0.
|
||||
# Note that there are a couple of TOML lists in this file.
|
||||
# Find more information on toml format here: https://github.com/toml-lang/toml
|
||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
modLoader = "javafml" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion = "${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "${loader_version_range}"
|
||||
license = "${mod_license}"
|
||||
# A URL to refer people to when problems occur with this mod
|
||||
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
||||
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||
[[mods]] #mandatory
|
||||
# The modid of the mod
|
||||
modId = "${mod_id}" #mandatory
|
||||
# The version number of the mod
|
||||
version = "${mod_version}" #mandatory
|
||||
# A display name for the mod
|
||||
displayName = "${mod_name}" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
|
||||
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
|
||||
# A file name (in the root of the mod JAR) containing a logo for display
|
||||
#logoFile="vmodaddon.png" #optional
|
||||
# A text field displayed in the mod UI
|
||||
#credits="Thanks for this example mod goes to Java" #optional
|
||||
# A text field displayed in the mod UI
|
||||
authors = "${mod_authors}" #optional
|
||||
# Display Test controls the display for your mod in the server connection screen
|
||||
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
|
||||
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
|
||||
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
|
||||
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
|
||||
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
|
||||
#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional)
|
||||
|
||||
# The description text for the mod (multi line!) (#mandatory)
|
||||
[[mods]]
|
||||
modId = "${mod_id}"
|
||||
version = "${mod_version}"
|
||||
displayName = "${mod_name}"
|
||||
authors = "${mod_authors}"
|
||||
description = '''${mod_description}'''
|
||||
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||
[[dependencies."${mod_id}"]] #optional
|
||||
# the modid of the dependency
|
||||
modId = "forge" #mandatory
|
||||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory = true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange = "${forge_version_range}" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
|
||||
# BEFORE - This mod is loaded BEFORE the dependency
|
||||
# AFTER - This mod is loaded AFTER the dependency
|
||||
[[dependencies."${mod_id}"]]
|
||||
modId = "forge"
|
||||
mandatory = true
|
||||
versionRange = "${forge_version_range}"
|
||||
ordering = "NONE"
|
||||
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
|
||||
side = "SERVER"# Here's another dependency
|
||||
side = "SERVER"
|
||||
[[dependencies."${mod_id}"]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||
versionRange = "${minecraft_version_range}"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"variants": {
|
||||
"": { "model": "vmodaddon:block/track_b" }
|
||||
}
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"block.vmodaddon.track_b": "Track Backup",
|
||||
"block.vmodaddon.ship_void": "Ship Void"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"variants": {
|
||||
"": { "model": "vmodextras:block/track_backup" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"block.vmodextras.track_backup": "Track Backup",
|
||||
"block.vmodextras.ship_void": "Ship Void"
|
||||
}
|
|
@ -2,8 +2,8 @@
|
|||
"credit": "Made with Blockbench",
|
||||
"texture_size": [64, 64],
|
||||
"textures": {
|
||||
"1": "vmodaddon:block/track_b",
|
||||
"particle": "vmodaddon:block/track_b"
|
||||
"1": "vmodextras:block/track_backup",
|
||||
"particle": "vmodextras:block/track_backup"
|
||||
},
|
||||
"elements": [
|
||||
{
|
|
@ -2,8 +2,8 @@
|
|||
"credit": "Made with Blockbench",
|
||||
"texture_size": [64, 64],
|
||||
"textures": {
|
||||
"1": "vmodaddon:block/track_b",
|
||||
"particle": "vmodaddon:block/track_b"
|
||||
"1": "vmodextras:block/track_backup",
|
||||
"particle": "vmodextras:block/track_backup"
|
||||
},
|
||||
"elements": [
|
||||
{
|
Before Width: | Height: | Size: 434 B After Width: | Height: | Size: 434 B |
|
@ -1,12 +0,0 @@
|
|||
[
|
||||
{
|
||||
"block": "vmodaddon:ship_void",
|
||||
"mass": 0.0,
|
||||
"friction": 0.0
|
||||
},
|
||||
{
|
||||
"block": "vmodaddon:track_b",
|
||||
"mass": 40.0,
|
||||
"friction": 0.0
|
||||
}
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
[
|
||||
{
|
||||
"block": "vmodextras:ship_void",
|
||||
"mass": 0.0,
|
||||
"friction": 0.0
|
||||
},
|
||||
{
|
||||
"block": "vmodextras:track_backup",
|
||||
"mass": 120.0,
|
||||
"friction": 0.0
|
||||
},
|
||||
{
|
||||
"block": "vmodextras:compact_backup",
|
||||
"mass": 120.0,
|
||||
"friction": 0.0
|
||||
}
|
||||
]
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "space.eptaproject.vmodaddon.mixins",
|
||||
"package": "space.eptaproject.vmodextras.mixins",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"refmap": "vmodaddon.refmap.json",
|
||||
"refmap": "vmodextras.refmap.json",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
|
@ -11,5 +11,5 @@
|
|||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"plugin": "space.eptaproject.vmodaddon.mixin.MixinPlugin"
|
||||
"plugin": "space.eptaproject.vmodextras.mixin.MixinPlugin"
|
||||
}
|
Loading…
Reference in New Issue