forked from jcm236/Starlance
-
Notifications
You must be signed in to change notification settings - Fork 0
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
7 changed files
with
103 additions
and
11 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
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 |
---|---|---|
@@ -1,10 +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 { | ||
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)); | ||
} | ||
} |
20 changes: 17 additions & 3 deletions
20
src/main/java/net/jcm/vsch/blocks/entity/DockerBlockEntity.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 |
---|---|---|
@@ -1,13 +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 class DockerBlockEntity extends BlockEntity{ | ||
|
||
public DockerBlockEntity(BlockEntityType<?> pType, BlockPos pPos, BlockState pBlockState) { | ||
super(pType, pPos, pBlockState); | ||
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); | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
src/main/java/net/jcm/vsch/mixin/MixinAerialLightRenderer.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,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; | ||
} | ||
|
||
} |
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