Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/net/jcm/vsch/util/VSCHUtils.java
  • Loading branch information
GuyApooye committed Jan 14, 2025
2 parents 364476d + 6779d7c commit b93aecb
Show file tree
Hide file tree
Showing 15 changed files with 126 additions and 57 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mod_group_id=net.jcm
mod_authors=Jcm, Brickyboy
mod_description=Adds Valkyrien Skies compat to Cosmic Horizons, as well as space-focused blocks for VS ships. [WIP]

cosmos_version=0.0.7.3
cosmos_version=0.0.7.2
vs2_mc_version=120
#vs2_version=2.5.0-beta.1+a81efdff02
#vs_core_version=1.1.0+cf7b0d3c5b
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/net/jcm/vsch/blocks/VSCHBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@

import net.jcm.vsch.VSCHMod;

import net.jcm.vsch.blocks.custom.AirThrusterBlock;
import net.jcm.vsch.blocks.custom.DragInducerBlock;
import net.jcm.vsch.blocks.custom.GravityInducerBlock;
import net.jcm.vsch.blocks.custom.MagnetBlock;
import net.jcm.vsch.blocks.custom.PowerfulThrusterBlock;
import net.jcm.vsch.blocks.custom.ThrusterBlock;
import net.jcm.vsch.blocks.custom.*;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
Expand Down Expand Up @@ -52,6 +47,11 @@ public class VSCHBlocks {
.strength(5f)
.noOcclusion()));

public static final RegistryObject<Block> DOCKER_BLOCK = registerBlock("dock",
() -> new DockerBlock(BlockBehaviour.Properties.copy(Blocks.IRON_BLOCK).sound(SoundType.COPPER)
.strength(5f)
.noOcclusion()));

/*public static final RegistryObject<Block> MAGNET_BLOCK = registerBlock("magnet_block",
() -> new MagnetBlock(BlockBehaviour.Properties.copy(Blocks.IRON_BLOCK).sound(SoundType.COPPER)
.strength(5f)
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/net/jcm/vsch/blocks/custom/DockerBlock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package net.jcm.vsch.blocks.custom;

import net.jcm.vsch.blocks.entity.DockerBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.Nullable;

public class DockerBlock extends Block implements EntityBlock {
public DockerBlock(Properties properties) {
super(properties);
}

@Override
public @Nullable BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
return new DockerBlockEntity(blockPos,blockState);
}

@Override
public @Nullable <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
return level.isClientSide() ? ((level0, pos0, state0, be) -> ((DockerBlockEntity) be).clientTick(level0, pos0, state0, (DockerBlockEntity) be)) : ((level0, pos0, state0, be) -> ((DockerBlockEntity) be).serverTick(level0, pos0, state0, (DockerBlockEntity) be));
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package net.jcm.vsch.blocks.custom.template;

import org.valkyrienskies.mod.common.util.VectorConversionsMCKt;

import net.jcm.vsch.blocks.entity.AbstractThrusterBlockEntity;
import net.jcm.vsch.blocks.entity.template.AbstractThrusterBlockEntity;
import net.jcm.vsch.config.VSCHConfig;
import net.jcm.vsch.items.VSCHItems;
import net.jcm.vsch.ship.ThrusterData;
import net.jcm.vsch.ship.ThrusterData.ThrusterMode;
import net.jcm.vsch.ship.VSCHForceInducedShips;
import net.jcm.vsch.util.rot.DirectionalShape;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package net.jcm.vsch.blocks.entity;

import net.jcm.vsch.blocks.entity.template.AbstractThrusterBlockEntity;
import org.joml.Vector3d;

import net.jcm.vsch.config.VSCHConfig;

import net.lointain.cosmos.init.CosmosModParticleTypes;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;

public class AirThrusterBlockEntity extends AbstractThrusterBlockEntity {
Expand Down
27 changes: 27 additions & 0 deletions src/main/java/net/jcm/vsch/blocks/entity/DockerBlockEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package net.jcm.vsch.blocks.entity;

import net.jcm.vsch.blocks.entity.template.ParticleBlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;

public class DockerBlockEntity extends BlockEntity{

public DockerBlockEntity(BlockPos pPos, BlockState pBlockState) {
super(VSCHBlockEntities.DOCKER_BLOCK_ENTITY.get(), pPos, pBlockState);
}

public void clientTick(Level level, BlockPos pos, BlockState state, DockerBlockEntity be) {

}

public void serverTick(Level level, BlockPos pos, BlockState state, DockerBlockEntity be) {
HitResult hitResult = level.clip(new ClipContext(pos.getCenter(),pos.getCenter().add(new Vec3(0,10,0)),ClipContext.Block.COLLIDER,ClipContext.Fluid.NONE,null));
System.out.println(hitResult);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package net.jcm.vsch.blocks.entity;

import net.jcm.vsch.blocks.VSCHBlocks;
import net.jcm.vsch.blocks.entity.template.ParticleBlockEntity;
import net.jcm.vsch.config.VSCHConfig;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
Expand Down
41 changes: 0 additions & 41 deletions src/main/java/net/jcm/vsch/blocks/entity/ParticleBlockEntity.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.jcm.vsch.blocks.entity;

import net.jcm.vsch.blocks.entity.template.AbstractThrusterBlockEntity;
import net.jcm.vsch.config.VSCHConfig;

import net.lointain.cosmos.init.CosmosModParticleTypes;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.jcm.vsch.blocks.entity;

import net.jcm.vsch.blocks.entity.template.AbstractThrusterBlockEntity;
import net.jcm.vsch.config.VSCHConfig;

import net.minecraft.core.BlockPos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public class VSCHBlockEntities {
() -> BlockEntityType.Builder.of(GravityInducerBlockEntity::new, VSCHBlocks.GRAVITY_INDUCER_BLOCK.get())
.build(null));

public static final RegistryObject<BlockEntityType<DockerBlockEntity>> DOCKER_BLOCK_ENTITY =
BLOCK_ENTITIES.register("dock",
() -> BlockEntityType.Builder.of(DockerBlockEntity::new, VSCHBlocks.DOCKER_BLOCK.get())
.build(null));



public static void register(IEventBus eventBus) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.jcm.vsch.blocks.entity;
package net.jcm.vsch.blocks.entity.template;

import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.shared.Capabilities;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package net.jcm.vsch.blocks.entity.template;

import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;

public interface ParticleBlockEntity {

default void clientTick(Level level, BlockPos pos, BlockState state, ParticleBlockEntity be) {
tickParticles(level, pos, state);
}

default void serverTick(Level level, BlockPos pos, BlockState state, ParticleBlockEntity be) {
if (level instanceof ServerLevel) {
tickForce(level, pos, state);
}
}

void tickForce(Level level, BlockPos pos, BlockState state);

void tickParticles(Level level, BlockPos pos, BlockState state);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import dan200.computercraft.api.lua.LuaFunction;
import dan200.computercraft.api.peripheral.IPeripheral;

import net.jcm.vsch.blocks.entity.AbstractThrusterBlockEntity;
import net.jcm.vsch.blocks.entity.template.AbstractThrusterBlockEntity;
import net.jcm.vsch.ship.ThrusterData;

public class ThrusterPeripheral implements IPeripheral {
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/net/jcm/vsch/mixin/MixinAerialLightRenderer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.jcm.vsch.mixin;

import net.lointain.cosmos.procedures.AerialLightRenderer;
import net.minecraftforge.fml.loading.FMLEnvironment;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

@Mixin(AerialLightRenderer.class)
public abstract class MixinAerialLightRenderer {

// getPrivateField fails when Cosmos is de-obfuscated in a dev enviroment, so this is here to stop that
@ModifyVariable(method = "getPrivateField", at = @At("HEAD"), argsOnly = true)
private static String fixFieldName(String fieldName) {

// Check if we are dev enviroment or obf enviroment
if (!FMLEnvironment.production) {
if (fieldName.equals("f_110009_")) {
return "passes";
}
if (fieldName.equals("f_110054_")) {
return "effect";
}
}

return fieldName;
}

}

0 comments on commit b93aecb

Please sign in to comment.