generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
优化了存储矿车的数据同步方法 对 pcaSyncProtocol 增加了鉴权,只有 op 可以获取别的玩家的数据,所有人都可以获取 bot 的数据(强烈建议更新) 新增了使用染料对潜影盒染色的功能
- Loading branch information
Showing
13 changed files
with
89 additions
and
88 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
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
40 changes: 0 additions & 40 deletions
40
src/main/java/com/plusls/carpet/mixin/rule/pcaSyncProtocol/item/MixinItemStack.java
This file was deleted.
Oops, something went wrong.
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
55 changes: 55 additions & 0 deletions
55
src/main/java/com/plusls/carpet/mixin/rule/useDyeOnShulkerBox/MixinDyeItem.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,55 @@ | ||
package com.plusls.carpet.mixin.rule.useDyeOnShulkerBox; | ||
|
||
import com.plusls.carpet.PcaSettings; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.Blocks; | ||
import net.minecraft.block.ShulkerBoxBlock; | ||
import net.minecraft.block.entity.ShulkerBoxBlockEntity; | ||
import net.minecraft.item.DyeItem; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemUsageContext; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.util.ActionResult; | ||
import net.minecraft.util.DyeColor; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(DyeItem.class) | ||
public abstract class MixinDyeItem extends Item { | ||
@Shadow public abstract DyeColor getColor(); | ||
|
||
public MixinDyeItem(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
public ActionResult useOnBlock(ItemUsageContext context) { | ||
if (!PcaSettings.useDyeOnShulkerBox) { | ||
return ActionResult.PASS; | ||
} | ||
World world = context.getWorld(); | ||
BlockPos pos = context.getBlockPos(); | ||
BlockState blockState = world.getBlockState(pos); | ||
|
||
if (blockState.isOf(Blocks.SHULKER_BOX)) { | ||
if (!world.isClient()) { | ||
ShulkerBoxBlockEntity blockEntity = (ShulkerBoxBlockEntity)world.getBlockEntity(pos); | ||
BlockState newBlockState = ShulkerBoxBlock.get(getColor()).getDefaultState(). | ||
with(ShulkerBoxBlock.FACING, blockState.get(ShulkerBoxBlock.FACING)); | ||
|
||
if (world.setBlockState(pos, newBlockState)) { | ||
ShulkerBoxBlockEntity newBlockEntity = (ShulkerBoxBlockEntity)world.getBlockEntity(pos); | ||
assert blockEntity != null; | ||
assert newBlockEntity != null; | ||
newBlockEntity.deserializeInventory(blockEntity.serializeInventory(new CompoundTag())); | ||
newBlockEntity.markDirty(); | ||
context.getStack().decrement(1); | ||
} | ||
} | ||
return ActionResult.success(world.isClient); | ||
} | ||
return ActionResult.PASS; | ||
} | ||
} |
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
7 changes: 0 additions & 7 deletions
7
src/main/java/com/plusls/carpet/util/rule/pcaSyncProtocol/IItemStackMonitor.java
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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