So much TODO!
This commit is contained in:
parent
d23f20c0f8
commit
475e6c2437
7 changed files with 105 additions and 42 deletions
|
@ -12,7 +12,6 @@ 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 net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
|
||||
import su.a71.tardim_ic.tardim_ic.blocks.food_machine.FoodMachineBlock;
|
||||
import su.a71.tardim_ic.tardim_ic.blocks.food_machine.FoodMachineTileEntity;
|
||||
|
@ -67,10 +66,10 @@ public class Registration {
|
|||
Exteriors.register(); // Register custom TARDIM exteriors
|
||||
|
||||
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)));
|
||||
Registry.register(Registry.ITEM, new ResourceLocation(Constants.MOD_ID, "redstone_tardim_input"), new BlockItem(REDSTONE_TARDIM_INPUT, new Item.Properties().tab(TARDIM_IC_TAB)));
|
||||
|
||||
Registry.register(Registry.BLOCK, new ResourceLocation(Constants.MOD_ID, "food_machine"), FOOD_MACHINE);
|
||||
Registry.register(Registry.ITEM, new ResourceLocation(Constants.MOD_ID, "food_machine"), new BlockItem(FOOD_MACHINE, new FabricItemSettings().tab(TARDIM_IC_TAB)));
|
||||
Registry.register(Registry.ITEM, new ResourceLocation(Constants.MOD_ID, "food_machine"), new BlockItem(FOOD_MACHINE, new Item.Properties().tab(TARDIM_IC_TAB)));
|
||||
|
||||
Registry.register(Registry.SOUND_EVENT, CLOISTER_SOUND, CLOISTER_SOUND_EVENT);
|
||||
|
||||
|
|
|
@ -6,10 +6,13 @@ import com.swdteam.tardim.tardim.TardimData;
|
|||
import com.swdteam.tardim.tardim.TardimManager;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.contents.TranslatableContents;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
@ -22,7 +25,8 @@ import static su.a71.tardim_ic.tardim_ic.Registration.PERSONAL_JAMMER;
|
|||
|
||||
@Mixin(value = CommandLocate.class, remap = false)
|
||||
public class JammerMixin {
|
||||
// @Inject(method="execute()V", at=@At(value = "INVOKE", target = "Lcom/swdteam/tardim/tardim/TardimData;setTravelLocation(Lcom/swdteam/tardim/tardim/TardimData$Location;)V"))
|
||||
// @Inject(method="execute()V", at=@At(value = "INVOKE",
|
||||
// target = "Lcom/swdteam/tardim/tardim/TardimData;setTravelLocation(Lcom/swdteam/tardim/tardim/TardimData$Location;)V"))
|
||||
// public void execute(CallbackInfo ci) {
|
||||
// LOG.info("test");
|
||||
//// for (ItemStack armour : player.getArmorSlots()) {
|
||||
|
@ -32,4 +36,33 @@ public class JammerMixin {
|
|||
//// };
|
||||
//// }
|
||||
// }
|
||||
|
||||
@Overwrite
|
||||
public void execute(String[] args, Player player, BlockPos pos, CommandTardimBase.CommandSource source) {
|
||||
if (args.length == 1) {
|
||||
TardimData data = TardimManager.getFromPos(pos);
|
||||
if (data != null) {
|
||||
if (data.hasPermission(player)) {
|
||||
Player otherPlayer = player.getServer().getPlayerList().getPlayerByName(args[0]);
|
||||
if (otherPlayer != null) {
|
||||
for (ItemStack armour : otherPlayer.getArmorSlots()) {
|
||||
if (armour.is(PERSONAL_JAMMER)) {
|
||||
sendResponse(player, otherPlayer.getGameProfile().getName() + "'s location is jammed", CommandTardimBase.ResponseType.FAIL, source);
|
||||
return;
|
||||
}
|
||||
}
|
||||
data.setTravelLocation(new TardimData.Location(otherPlayer.blockPosition(), otherPlayer.level.dimension()));
|
||||
sendResponse(player, "Coords locked on to " + otherPlayer.getGameProfile().getName(), CommandTardimBase.ResponseType.COMPLETE, source);
|
||||
} else {
|
||||
sendResponse(player, "Player does not exist", CommandTardimBase.ResponseType.FAIL, source);
|
||||
}
|
||||
} else {
|
||||
sendResponse(player, "You do not have permission", CommandTardimBase.ResponseType.FAIL, source);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sendResponse(player, ((CommandLocate)(Object)this).getUsage(), CommandTardimBase.ResponseType.FAIL, source);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
"refmap": "refmap.tardim_ic.json",
|
||||
"mixins": [
|
||||
"BetterFuelMapMixin",
|
||||
"BetterFuelStorageMixin"
|
||||
"BetterFuelStorageMixin",
|
||||
"JammerMixin"
|
||||
],
|
||||
"client": [
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue