TheBrokenRail
9096dbd53a
All checks were successful
EnergonRelics/pipeline/head This commit looks good
35 lines
990 B
Java
35 lines
990 B
Java
package com.thebrokenrail.energonrelics.block.entity.shifter;
|
|
|
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.nbt.CompoundTag;
|
|
|
|
class PhasedItem {
|
|
final ItemStack item;
|
|
int cooldown = 0;
|
|
int roll = 0;
|
|
|
|
PhasedItem(ItemStack item) {
|
|
this.item = item;
|
|
}
|
|
|
|
int getRange() {
|
|
return HardcodedConfig.PHASE_SHIFTER_INPUT_RANGE_BASE + (roll * HardcodedConfig.PHASE_SHIFTER_INPUT_RANGE_INCREMENT);
|
|
}
|
|
|
|
CompoundTag toTag() {
|
|
CompoundTag tag = new CompoundTag();
|
|
tag.put("Item", item.toTag(new CompoundTag()));
|
|
tag.putInt("Cooldown", cooldown);
|
|
tag.putInt("Roll", roll);
|
|
return tag;
|
|
}
|
|
|
|
static PhasedItem fromTag(CompoundTag tag) {
|
|
PhasedItem item = new PhasedItem(ItemStack.fromTag(tag.getCompound("Item")));
|
|
item.cooldown = tag.getInt("Cooldown");
|
|
item.roll = tag.getInt("Roll");
|
|
return item;
|
|
}
|
|
}
|