Fabric?! IMPOSSIBLE
This commit is contained in:
parent
c3a67bb2e6
commit
f4ad251895
16 changed files with 195 additions and 44 deletions
|
@ -36,10 +36,9 @@ dependencies {
|
|||
|
||||
// CC: R and TARDIM
|
||||
//implementation("curse.maven:cc-restitched-462672:3908334")
|
||||
compileOnly("org.squiddev:cc-tweaked-1.19.1:${cc_version}")
|
||||
compileOnly("curse.maven:tardim-531315:4453925")
|
||||
//compileOnly("org.squiddev:cc-tweaked-1.19.1:${cc_version}")
|
||||
//compileOnly("curse.maven:tardim-531315:4453925")
|
||||
//implementation ("org.squiddev:cc-tweaked-1.19.1:${cc_version}")
|
||||
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
|
@ -13,6 +13,12 @@ dependencies {
|
|||
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
|
||||
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
|
||||
implementation project(":Common")
|
||||
|
||||
modApi 'com.electronwill.night-config:core:3.6.3'
|
||||
modApi 'com.electronwill.night-config:toml:3.6.3'
|
||||
|
||||
modImplementation "curse.maven:tardim-531315:4453924"
|
||||
modImplementation "curse.maven:cc-restitched-462672:3908334"
|
||||
}
|
||||
|
||||
loom {
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package su.a71.tardim_ic.tardim_ic;
|
||||
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.core.Registry;
|
||||
|
||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
|
||||
|
||||
|
||||
//import su.a71.tardim_ic.tardim_ic.digital_interface.DigitalInterfaceBlock;
|
||||
//import su.a71.tardim_ic.tardim_ic.digital_interface.DigitalInterfaceTileEntity;
|
||||
import su.a71.tardim_ic.tardim_ic.redstone_input.RedstoneInputBlock;
|
||||
import su.a71.tardim_ic.tardim_ic.redstone_input.RedstoneInputTileEntity;
|
||||
|
||||
import su.a71.tardim_ic.tardim_ic.Constants;
|
||||
|
||||
public class Registration {
|
||||
// Blocks
|
||||
|
||||
//public static final RegistryObject<Block> DIGITAL_TARDIM_INTERFACE = register("digital_tardim_interface", DigitalInterfaceBlock::new);
|
||||
public static final Block REDSTONE_TARDIM_INPUT = new RedstoneInputBlock();
|
||||
|
||||
// Tile Entities
|
||||
//public static final RegistryObject<BlockEntityType<DigitalInterfaceTileEntity>> DIGITAL_TARDIM_INTERFACE_TILEENTITY = Registration.BLOCK_ENTITIES.register("digital_tardim_interface", () -> new BlockEntityType<>(DigitalInterfaceTileEntity::new, Sets.newHashSet(DIGITAL_TARDIM_INTERFACE.get()), null));
|
||||
//public static final BlockEntityType<RedstoneInputTileEntity> REDSTONE_TARDIM_INPUT_TILEENTITY= new RedstoneInputTileEntity();
|
||||
public static final BlockEntityType<RedstoneInputTileEntity> REDSTONE_TARDIM_INPUT_TILEENTITY = Registry.register(
|
||||
Registry.BLOCK_ENTITY_TYPE,
|
||||
new ResourceLocation("tardim_ic", "redstone_tardim_input"),
|
||||
FabricBlockEntityTypeBuilder.create(RedstoneInputTileEntity::new, REDSTONE_TARDIM_INPUT).build()
|
||||
);
|
||||
|
||||
private static final CreativeModeTab TARDIM_IC_TAB = FabricItemGroupBuilder
|
||||
.create(new ResourceLocation("tardim_ic", "main"))
|
||||
.icon(() -> new ItemStack(REDSTONE_TARDIM_INPUT))
|
||||
.build();
|
||||
|
||||
|
||||
// Register our stuff
|
||||
public static void register() {
|
||||
Registry.register(Registry.BLOCK, new ResourceLocation(Constants.MOD_ID, "redstone_tardim_input"), REDSTONE_TARDIM_INPUT);
|
||||
Registry.register(Registry.ITEM, new ResourceLocation(Constants.MOD_ID, "redstone_tardim_input"), new BlockItem(REDSTONE_TARDIM_INPUT, new FabricItemSettings().tab(TARDIM_IC_TAB)));
|
||||
|
||||
}
|
||||
}
|
|
@ -6,5 +6,6 @@ public class TardimInControl implements ModInitializer {
|
|||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
Registration.register();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
package su.a71.tardim_ic.tardim_ic.redstone_input;
|
||||
|
||||
import com.swdteam.tardim.common.block.BlockBaseTardimPanel;
|
||||
import com.swdteam.tardim.common.init.TRDDimensions;
|
||||
import com.swdteam.tardim.common.init.TRDSounds;
|
||||
import com.swdteam.tardim.network.NetworkHandler;
|
||||
import com.swdteam.tardim.network.PacketOpenEditGui;
|
||||
import com.swdteam.tardim.tardim.TardimData;
|
||||
import com.swdteam.tardim.tardim.TardimManager;
|
||||
import com.swdteam.tardim.tileentity.TileEntityBaseTardimPanel;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
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.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import su.a71.tardim_ic.tardim_ic.Registration;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RedstoneInputBlock extends BlockBaseTardimPanel implements EntityBlock {
|
||||
private boolean isPowered = false;
|
||||
private Player lastPlayer = null;
|
||||
public RedstoneInputBlock() {
|
||||
super(FabricBlockSettings.of(Material.METAL).strength(2, 4)); // No occlusion?
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) {
|
||||
return Registration.REDSTONE_TARDIM_INPUT_TILEENTITY.create(pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult use(BlockState blockState, Level w, BlockPos blockPos, Player player, InteractionHand hand, BlockHitResult p_60508_) {
|
||||
if (!w.isClientSide) {
|
||||
|
||||
w.playSound(null, blockPos, TRDSounds.TARDIM_BEEP, SoundSource.BLOCKS, 0.3F, 0.5F);
|
||||
|
||||
BlockEntity be = w.getBlockEntity(blockPos);
|
||||
if (be instanceof TileEntityBaseTardimPanel && w.dimension() == TRDDimensions.TARDIS) {
|
||||
TardimData data = TardimManager.getFromPos(blockPos);
|
||||
if (data != null && data.hasPermission(player)) {
|
||||
this.lastPlayer = player;
|
||||
NetworkHandler.sendTo((ServerPlayer)player, new PacketOpenEditGui(blockPos, 1));
|
||||
return InteractionResult.CONSUME;
|
||||
}
|
||||
|
||||
player.displayClientMessage(
|
||||
Component.literal("You do not have permission").withStyle(ChatFormatting.DARK_RED).withStyle(ChatFormatting.BOLD), true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResult.CONSUME;
|
||||
}
|
||||
|
||||
public boolean canSurvive(BlockState blockState, LevelReader levelReader, BlockPos blockPos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block block, BlockPos fromPos, boolean isMoving) {
|
||||
DebugPackets.sendNeighborsUpdatePacket(level, blockPos);
|
||||
|
||||
// get redstone signal
|
||||
Direction direction = blockState.getValue(FACING);
|
||||
int redstoneSignal = level.getSignal(blockPos, direction);
|
||||
if (redstoneSignal > 0 && !isPowered) {
|
||||
isPowered = true;
|
||||
BlockEntity be = level.getBlockEntity(blockPos);
|
||||
if (be instanceof TileEntityBaseTardimPanel && level.dimension() == TRDDimensions.TARDIS) {
|
||||
TardimData data = TardimManager.getFromPos(blockPos);
|
||||
if (data != null && !level.isClientSide && this.lastPlayer != null) {
|
||||
if (((TileEntityBaseTardimPanel)be).hasCommand()) {
|
||||
((TileEntityBaseTardimPanel)be).execute(this.lastPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (redstoneSignal == 0 && isPowered)
|
||||
isPowered = false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package su.a71.tardim_ic.tardim_ic.redstone_input;
|
||||
|
||||
import com.swdteam.tardim.tileentity.TileEntityBaseTardimPanel;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import su.a71.tardim_ic.tardim_ic.Registration;
|
||||
|
||||
|
||||
public class RedstoneInputTileEntity extends TileEntityBaseTardimPanel {
|
||||
public RedstoneInputTileEntity(BlockPos pos, BlockState state) {
|
||||
super(Registration.REDSTONE_TARDIM_INPUT_TILEENTITY, pos, state);
|
||||
}
|
||||
|
||||
public BlockPos getPos() {
|
||||
return this.worldPosition;
|
||||
}
|
||||
}
|
|
@ -1,39 +1,34 @@
|
|||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "modid",
|
||||
"id": "tardim_ic",
|
||||
"version": "${version}",
|
||||
|
||||
"name": "Example Mod",
|
||||
"description": "This is an example description! Tell everyone what your mod is about!",
|
||||
"name": "Tardim: In Control",
|
||||
"description": "All of time and space, now automated. Control your TARDIM using ComputerCraft: Tweaked.",
|
||||
"authors": [
|
||||
"Me!"
|
||||
"Andrew_7_1"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://fabricmc.net/",
|
||||
"sources": "https://github.com/FabricMC/fabric-example-mod"
|
||||
},
|
||||
|
||||
"license": "CC0-1.0",
|
||||
"icon": "assets/modid/icon.png",
|
||||
"license": "MIT",
|
||||
"icon": "icon.png",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"com.example.examplemod.ExampleMod"
|
||||
"su.a71.tardim_ic.tardim_ic.TardimInControl"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"modid.mixins.json"
|
||||
],
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14",
|
||||
"fabricloader": ">=0.14.10",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.19.x",
|
||||
"java": ">=17"
|
||||
},
|
||||
"suggests": {
|
||||
"another-mod": "*"
|
||||
"java": ">=17",
|
||||
"tardim": ">=1.2.2"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.example.examplemod.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"ExampleMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
|
|
@ -3,8 +3,6 @@ package su.a71.tardim_ic.tardim_ic;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import su.a71.tardim_ic.tardim_ic.Constants;
|
||||
|
||||
import su.a71.tardim_ic.tardim_ic.registration.CommandInit;
|
||||
|
||||
// The value here should match an entry in the META-INF/mods.toml file
|
||||
|
@ -12,7 +10,7 @@ import su.a71.tardim_ic.tardim_ic.registration.CommandInit;
|
|||
public class TardimInControl {
|
||||
|
||||
// Our mod id
|
||||
public static final String MODID = "tardim_ic";
|
||||
public static final String MODID = Constants.MOD_ID;
|
||||
|
||||
public TardimInControl() {
|
||||
Registration.register();
|
||||
|
|
|
@ -14,8 +14,6 @@ import net.minecraft.world.entity.player.Player;
|
|||
import dan200.computercraft.api.network.Packet;
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
|
||||
import static com.swdteam.common.command.tardim.CommandTardimBase.sendResponse;
|
||||
|
||||
public class CommandModemTransmit implements ICommand {
|
||||
@Override
|
||||
public void execute(String[] args, Player player, BlockPos pos, CommandTardimBase.CommandSource source) {
|
|
@ -1,7 +1,6 @@
|
|||
package su.a71.tardim_ic.tardim_ic.redsone_input;
|
||||
|
||||
import com.swdteam.common.block.BlockBaseTardimPanel;
|
||||
|
||||
import com.swdteam.common.init.TRDDimensions;
|
||||
import com.swdteam.common.init.TRDSounds;
|
||||
import com.swdteam.network.NetworkHandler;
|
||||
|
@ -29,14 +28,15 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
|
||||
import net.minecraftforge.common.util.FakePlayerFactory; // TODO: ???
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import su.a71.tardim_ic.tardim_ic.Registration;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RedstoneInputBlock extends BlockBaseTardimPanel implements EntityBlock {
|
||||
private boolean isPowered = false;
|
||||
public RedstoneInputBlock() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# TARDIM: In Control
|
||||
# TARDIM: In Control 
|
||||
### All of time and space, *now automated*.
|
||||
|
||||
This mod is an addon for the [TARDIM mod](https://modrinth.com/mod/tardim), and adds a way to control your time (but mostly space) machine with [ComputerCraft: Tweaked](https://tweaked.cc) computers and redstone using a new blocks and peripherals.
|
||||
|
|
|
@ -14,7 +14,7 @@ forge_version=43.1.30
|
|||
|
||||
# Fabric
|
||||
fabric_version=0.62.0+1.19.2
|
||||
fabric_loader_version=0.14.9
|
||||
fabric_loader_version=0.14.10
|
||||
|
||||
# Mod options
|
||||
mod_name=tardim_in_control
|
||||
|
|
Loading…
Add table
Reference in a new issue