Remove the Wrench

This commit is contained in:
raoulvdberge
2018-05-26 15:58:07 +02:00
parent 2eeba970a3
commit 3d8cdfcc0c
21 changed files with 10 additions and 345 deletions

View File

@@ -8,6 +8,7 @@
- You can no longer put a Filter in filter slots to gain additional filter slots (raoulvdberge)
- If an Interface is configured to expose the entire network storage (by configuring no export slots), it will no longer expose the entire RS storage, due to performance issues (raoulvdberge)
- The Portable Grid no longer exposes a inventory for crossmod interaction, due to performance issues (raoulvdberge)
- Removed the Wrench (raoulvdberge)
- Updated Russian translation (kellixon)
### 1.5.34

View File

@@ -19,6 +19,5 @@ public final class RSItems {
public static final ItemNetworkCard NETWORK_CARD = new ItemNetworkCard();
public static final ItemFluidStorageDisk FLUID_STORAGE_DISK = new ItemFluidStorageDisk();
public static final ItemFluidStoragePart FLUID_STORAGE_PART = new ItemFluidStoragePart();
public static final ItemWrench WRENCH = new ItemWrench();
public static final ItemSecurityCard SECURITY_CARD = new ItemSecurityCard();
}

View File

@@ -1,23 +0,0 @@
package com.raoulvdberge.refinedstorage.api.util;
import net.minecraft.nbt.NBTTagCompound;
/**
* Implement this on a tile that is wrenchable.
*/
public interface IWrenchable {
/**
* Writes the configuration of this tile to the wrench.
*
* @param tag the tag to write to
* @return the written tag
*/
NBTTagCompound writeConfiguration(NBTTagCompound tag);
/**
* Reads the configuration of this tile from the wrench.
*
* @param tag the tag to read
*/
void readConfiguration(NBTTagCompound tag);
}

View File

@@ -3,7 +3,6 @@ package com.raoulvdberge.refinedstorage.apiimpl.network.node;
import com.raoulvdberge.refinedstorage.api.network.INetwork;
import com.raoulvdberge.refinedstorage.api.network.INetworkNodeVisitor;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
import com.raoulvdberge.refinedstorage.api.util.IWrenchable;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.tile.TileBase;
import com.raoulvdberge.refinedstorage.tile.config.RedstoneMode;
@@ -22,7 +21,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.UUID;
public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor, IWrenchable {
public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor {
private static final String NBT_OWNER = "Owner";
@Nullable
@@ -149,7 +148,6 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor,
return tag;
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
redstoneMode.write(tag);
@@ -164,7 +162,6 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor,
readConfiguration(tag);
}
@Override
public void readConfiguration(NBTTagCompound tag) {
redstoneMode = RedstoneMode.read(tag);
}

View File

@@ -1,7 +1,6 @@
package com.raoulvdberge.refinedstorage.apiimpl.util;
import com.raoulvdberge.refinedstorage.api.util.IComparer;
import com.raoulvdberge.refinedstorage.block.BlockNode;
import com.raoulvdberge.refinedstorage.util.StackUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
@@ -176,9 +175,6 @@ public class Comparer implements IComparer {
stack.getTagCompound().removeTag("sjData");
stack.getTagCompound().removeTag("PackOn");
break;
case "refinedstorage":
stack.getTagCompound().removeTag(BlockNode.NBT_REFINED_STORAGE_DATA);
break;
case "immersiveengineering":
stack.getTagCompound().removeTag("hammerDmg");
stack.getTagCompound().removeTag("cutterDmg");

View File

@@ -16,8 +16,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public abstract class BlockNode extends BlockBase {
public static final String NBT_REFINED_STORAGE_DATA = "RefinedStorageData";
public static final PropertyBool CONNECTED = PropertyBool.create("connected");
public BlockNode(String name) {
@@ -36,15 +34,8 @@ public abstract class BlockNode extends BlockBase {
if (!world.isRemote) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileNode) {
if (stack.hasTagCompound() && stack.getTagCompound().hasKey(NBT_REFINED_STORAGE_DATA)) {
((TileNode) tile).getNode().readConfiguration(stack.getTagCompound().getCompoundTag(NBT_REFINED_STORAGE_DATA));
((TileNode) tile).getNode().markDirty();
}
if (placer instanceof EntityPlayer) {
((TileNode) tile).getNode().setOwner(((EntityPlayer) placer).getGameProfile().getId());
}
if (tile instanceof TileNode && placer instanceof EntityPlayer) {
((TileNode) tile).getNode().setOwner(((EntityPlayer) placer).getGameProfile().getId());
}
API.instance().discoverNode(world, pos);

View File

@@ -1,189 +0,0 @@
package com.raoulvdberge.refinedstorage.item;
import com.raoulvdberge.refinedstorage.api.util.IWrenchable;
import com.raoulvdberge.refinedstorage.block.BlockNode;
import com.raoulvdberge.refinedstorage.tile.TileNode;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.List;
public class ItemWrench extends ItemBase {
private enum WrenchMode {
ROTATION(0),
CONFIGURATION(1),
DISMANTLING(2);
private final int id;
WrenchMode(int id) {
this.id = id;
}
public WrenchMode cycle() {
return this == ROTATION ? CONFIGURATION : (this == CONFIGURATION ? DISMANTLING : ROTATION);
}
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
tag.setInteger(NBT_WRENCH_MODE, id);
return tag;
}
public static WrenchMode readFromNBT(NBTTagCompound tag) {
if (tag != null && tag.hasKey(NBT_WRENCH_MODE)) {
int id = tag.getInteger(NBT_WRENCH_MODE);
for (WrenchMode mode : values()) {
if (mode.id == id) {
return mode;
}
}
}
return ROTATION;
}
}
private static final String NBT_WRENCH_MODE = "WrenchMode";
private static final String NBT_WRENCHED_DATA = "WrenchedData";
private static final String NBT_WRENCHED_TILE = "WrenchedTile";
public ItemWrench() {
super("wrench");
setMaxStackSize(1);
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!player.isSneaking()) {
return EnumActionResult.PASS;
}
if (world.isRemote) {
return EnumActionResult.SUCCESS;
}
ItemStack stack = player.getHeldItem(hand);
WrenchMode mode = WrenchMode.readFromNBT(stack.getTagCompound());
if (mode == WrenchMode.ROTATION) {
Block block = world.getBlockState(pos).getBlock();
block.rotateBlock(world, pos, player.getHorizontalFacing().getOpposite());
return EnumActionResult.SUCCESS;
} else if (mode == WrenchMode.CONFIGURATION) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof IWrenchable) {
IWrenchable wrenchable = (IWrenchable) tile;
boolean canWrite = false;
if (stack.hasTagCompound() && stack.getTagCompound().hasKey(NBT_WRENCHED_DATA) && stack.getTagCompound().hasKey(NBT_WRENCHED_TILE)) {
NBTTagCompound wrenchedData = stack.getTagCompound().getCompoundTag(NBT_WRENCHED_DATA);
String wrenchedTile = stack.getTagCompound().getString(NBT_WRENCHED_TILE);
if (wrenchable.getClass().getName().equals(wrenchedTile)) {
wrenchable.readConfiguration(wrenchedData);
tile.markDirty();
player.sendMessage(new TextComponentTranslation("item.refinedstorage:wrench.read"));
} else {
canWrite = true;
}
} else {
canWrite = true;
}
if (canWrite) {
stack.getTagCompound().setString(NBT_WRENCHED_TILE, wrenchable.getClass().getName());
stack.getTagCompound().setTag(NBT_WRENCHED_DATA, wrenchable.writeConfiguration(new NBTTagCompound()));
player.sendMessage(new TextComponentTranslation("item.refinedstorage:wrench.saved"));
}
return EnumActionResult.SUCCESS;
}
} else if (mode == WrenchMode.DISMANTLING) {
TileEntity tile = world.getTileEntity(pos);
IBlockState state = world.getBlockState(pos);
if (tile instanceof TileNode) {
NBTTagCompound data = new NBTTagCompound();
((TileNode) tile).writeConfiguration(data);
NonNullList<ItemStack> drops = NonNullList.create();
state.getBlock().getDrops(drops, world, pos, state, 0);
ItemStack tileStack = drops.get(0);
if (!tileStack.hasTagCompound()) {
tileStack.setTagCompound(new NBTTagCompound());
}
tileStack.getTagCompound().setTag(BlockNode.NBT_REFINED_STORAGE_DATA, data);
world.setBlockToAir(pos);
InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), tileStack);
}
}
return EnumActionResult.PASS;
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
if (!world.isRemote && !player.isSneaking()) {
ItemStack stack = player.getHeldItem(hand);
WrenchMode mode = WrenchMode.readFromNBT(stack.getTagCompound());
if (stack.hasTagCompound()) {
stack.getTagCompound().removeTag(NBT_WRENCHED_TILE);
stack.getTagCompound().removeTag(NBT_WRENCHED_DATA);
} else {
stack.setTagCompound(new NBTTagCompound());
}
WrenchMode next = mode.cycle();
next.writeToNBT(stack.getTagCompound());
player.sendMessage(new TextComponentTranslation(
"item.refinedstorage:wrench.mode",
new TextComponentTranslation("item.refinedstorage:wrench.mode." + next.id).setStyle(new Style().setColor(TextFormatting.YELLOW))
));
}
return super.onItemRightClick(world, player, hand);
}
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag) {
super.addInformation(stack, world, tooltip, flag);
WrenchMode mode = WrenchMode.readFromNBT(stack.getTagCompound());
tooltip.add(I18n.format("item.refinedstorage:wrench.mode", TextFormatting.YELLOW + I18n.format("item.refinedstorage:wrench.mode." + mode.id) + TextFormatting.RESET));
}
}

View File

@@ -181,7 +181,6 @@ public class ProxyClient extends ProxyCommon {
ModelLoader.setCustomModelResourceLocation(RSItems.STORAGE_HOUSING, 0, new ModelResourceLocation("refinedstorage:storage_housing", "inventory"));
ModelLoader.setCustomModelResourceLocation(RSItems.FILTER, 0, new ModelResourceLocation("refinedstorage:filter", "inventory"));
ModelLoader.setCustomModelResourceLocation(RSItems.NETWORK_CARD, 0, new ModelResourceLocation("refinedstorage:network_card", "inventory"));
ModelLoader.setCustomModelResourceLocation(RSItems.WRENCH, 0, new ModelResourceLocation("refinedstorage:wrench", "inventory"));
ModelLoader.setCustomModelResourceLocation(RSItems.SECURITY_CARD, 0, new ModelResourceLocation("refinedstorage:security_card", "inventory"));
ModelLoader.setCustomModelResourceLocation(RSItems.UPGRADE, 0, new ModelResourceLocation("refinedstorage:upgrade", "inventory"));

View File

@@ -221,7 +221,6 @@ public class ProxyCommon {
registerItem(RSItems.UPGRADE);
registerItem(RSItems.FILTER);
registerItem(RSItems.NETWORK_CARD);
registerItem(RSItems.WRENCH);
registerItem(RSItems.SECURITY_CARD);
IntegrationInventorySorter.register();
@@ -282,28 +281,6 @@ public class ProxyCommon {
itemsToRegister.forEach(e.getRegistry()::register);
}
@SubscribeEvent
public void fixItemMappings(RegistryEvent.MissingMappings<Item> e) {
for (RegistryEvent.MissingMappings.Mapping<Item> missing : e.getMappings()) {
if (missing.key.getResourceDomain().equals(RS.ID)) {
if (missing.key.getResourcePath().equals("grid_filter")) {
missing.remap(RSItems.FILTER);
} else if (missing.key.getResourcePath().equals("processing_pattern_encoder")) {
missing.ignore();
}
}
}
}
@SubscribeEvent
public void fixBlockMappings(RegistryEvent.MissingMappings<Block> e) {
for (RegistryEvent.MissingMappings.Mapping<Block> missing : e.getMappings()) {
if (missing.key.getResourceDomain().equals(RS.ID) && missing.key.getResourcePath().equals("processing_pattern_encoder")) {
missing.ignore();
}
}
}
@SubscribeEvent
public void onHarvestCheck(PlayerEvent.HarvestCheck e) {
if (e.getTargetBlock().getBlock() instanceof BlockBase) {

View File

@@ -3,7 +3,6 @@ package com.raoulvdberge.refinedstorage.tile;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeManager;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
import com.raoulvdberge.refinedstorage.api.util.IWrenchable;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNode;
import com.raoulvdberge.refinedstorage.capability.CapabilityNetworkNodeProxy;
@@ -20,7 +19,7 @@ import net.minecraftforge.items.IItemHandler;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public abstract class TileNode<N extends NetworkNode> extends TileBase implements INetworkNodeProxy<N>, IRedstoneConfigurable, IWrenchable {
public abstract class TileNode<N extends NetworkNode> extends TileBase implements INetworkNodeProxy<N>, IRedstoneConfigurable {
public static final TileDataParameter<Integer, TileNode> REDSTONE_MODE = RedstoneMode.createParameter();
protected static final String NBT_ACTIVE = "Active";
@@ -41,11 +40,15 @@ public abstract class TileNode<N extends NetworkNode> extends TileBase implement
getNode().setRedstoneMode(mode);
}
@Override
public NBTTagCompound writeConfiguration(NBTTagCompound tag) {
return getNode().writeConfiguration(tag);
}
public void readConfiguration(NBTTagCompound tag) {
getNode().readConfiguration(tag);
getNode().markDirty();
}
@Override
public void setDirection(EnumFacing direction) {
super.setDirection(direction);
@@ -53,12 +56,6 @@ public abstract class TileNode<N extends NetworkNode> extends TileBase implement
getNode().resetDirection();
}
@Override
public void readConfiguration(NBTTagCompound tag) {
getNode().readConfiguration(tag);
getNode().markDirty();
}
public NBTTagCompound writeUpdate(NBTTagCompound tag) {
super.writeUpdate(tag);

View File

@@ -226,9 +226,3 @@ item.refinedstorage:upgrade.7.name=Verbesserung des Glück
item.refinedstorage:storage_housing.name=Diskettengehäuse
item.refinedstorage:filter.name=Filter
item.refinedstorage:network_card.name=Funk-Netzwerkkarte
item.refinedstorage:wrench.name=Schraubenschlüssel
item.refinedstorage:wrench.saved=Einstellungen schreiben
item.refinedstorage:wrench.read=Einstellungen lesen
item.refinedstorage:wrench.mode=Modus: %s
item.refinedstorage:wrench.mode.0=Ausrichtung
item.refinedstorage:wrench.mode.1=Einstellungen

View File

@@ -294,13 +294,6 @@ item.refinedstorage:upgrade.9.name=Fortune Upgrade
item.refinedstorage:storage_housing.name=Storage Housing
item.refinedstorage:filter.name=Filter
item.refinedstorage:network_card.name=Network Card
item.refinedstorage:wrench.name=Wrench
item.refinedstorage:wrench.saved=Configuration written.
item.refinedstorage:wrench.read=Configuration read.
item.refinedstorage:wrench.mode=Mode: %s
item.refinedstorage:wrench.mode.0=Rotation
item.refinedstorage:wrench.mode.1=Configuration
item.refinedstorage:wrench.mode.2=Dismantling
item.refinedstorage:security_card.name=Security Card
item.refinedstorage:security_card.owner=Bound to: %s

View File

@@ -292,13 +292,6 @@ item.refinedstorage:upgrade.9.name=Mejora de Fortuna
item.refinedstorage:storage_housing.name=Carcasa
item.refinedstorage:filter.name=Filtro
item.refinedstorage:network_card.name=Tarjeta de Red
item.refinedstorage:wrench.name=Llave inglesa
item.refinedstorage:wrench.saved=Configuración Escrita.
item.refinedstorage:wrench.read=Leer Configuración.
item.refinedstorage:wrench.mode=Modo: %s
item.refinedstorage:wrench.mode.0=Rotación
item.refinedstorage:wrench.mode.1=Configuración
item.refinedstorage:wrench.mode.2=Desmantelando
item.refinedstorage:security_card.name=Tarjeta de Seguridad
item.refinedstorage:security_card.owner=Designado a: %s

View File

@@ -266,13 +266,6 @@ item.refinedstorage:upgrade.7.name=Amélioration Fortune
item.refinedstorage:storage_housing.name=Boitier de stockage
item.refinedstorage:filter.name=Filtre
item.refinedstorage:network_card.name=Carte réseau
item.refinedstorage:wrench.name=Clé
item.refinedstorage:wrench.saved=Configuration sauvée.
item.refinedstorage:wrench.read=Configuration copiée.
item.refinedstorage:wrench.mode=Mode: %s
item.refinedstorage:wrench.mode.0=Rotation
item.refinedstorage:wrench.mode.1=Configuration
item.refinedstorage:wrench.mode.2=Démontage
item.refinedstorage:security_card.name=Carte de sécurité
item.refinedstorage:security_card.owner=Bound to: %s

View File

@@ -268,12 +268,5 @@ item.refinedstorage:upgrade.7.name=행운 업그레이드
item.refinedstorage:storage_housing.name=빈 저장 디스크
item.refinedstorage:filter.name=필터
item.refinedstorage:network_card.name=네트워크 카드
item.refinedstorage:wrench.name=렌치
item.refinedstorage:wrench.saved=설정 저장됨.
item.refinedstorage:wrench.read=설정 로드됨.
item.refinedstorage:wrench.mode=모드: %s
item.refinedstorage:wrench.mode.0=회전
item.refinedstorage:wrench.mode.1=설정
item.refinedstorage:wrench.mode.2=해체
item.refinedstorage:security_card.name=보안 카드
item.refinedstorage:security_card.owner=플레이어: %s

View File

@@ -270,13 +270,6 @@ item.refinedstorage:upgrade.9.name=Aprimoramento de Fortuna
item.refinedstorage:storage_housing.name=Alojamento de Armazenação
item.refinedstorage:filter.name=Filtro
item.refinedstorage:network_card.name=Cartão de Rede
item.refinedstorage:wrench.name=Chave Inglesa
item.refinedstorage:wrench.saved=Configuração escrita.
item.refinedstorage:wrench.read=Configuração lida.
item.refinedstorage:wrench.mode=Modo: %s
item.refinedstorage:wrench.mode.0=Rotação
item.refinedstorage:wrench.mode.1=Configuração
item.refinedstorage:wrench.mode.2=Desmontagem
item.refinedstorage:security_card.name=Cartão de Segurança
item.refinedstorage:security_card.owner=Ligado a: %s

View File

@@ -294,13 +294,6 @@ item.refinedstorage:upgrade.9.name=Улучшение: "Удача"
item.refinedstorage:storage_housing.name=Хранилище корпуса
item.refinedstorage:filter.name=Фильтр
item.refinedstorage:network_card.name=Сетевая карта
item.refinedstorage:wrench.name=Ключ
item.refinedstorage:wrench.saved=Конфигурация написана.
item.refinedstorage:wrench.read=Конфигурация читается.
item.refinedstorage:wrench.mode=Режим: %s
item.refinedstorage:wrench.mode.0=Вращение
item.refinedstorage:wrench.mode.1=Конфигурация
item.refinedstorage:wrench.mode.2=Демонтаж
item.refinedstorage:security_card.name=Карточка безопасности
item.refinedstorage:security_card.owner=Связано с: %s

View File

@@ -271,12 +271,5 @@ item.refinedstorage:upgrade.9.name=时运升级
item.refinedstorage:storage_housing.name=磁盘外壳
item.refinedstorage:filter.name=过滤升级
item.refinedstorage:network_card.name=网卡
item.refinedstorage:wrench.name=扳手
item.refinedstorage:wrench.saved=配置写入
item.refinedstorage:wrench.read=配置读出
item.refinedstorage:wrench.mode=模式:%s
item.refinedstorage:wrench.mode.0=旋转
item.refinedstorage:wrench.mode.1=配置
item.refinedstorage:wrench.mode.2=拆卸
item.refinedstorage:security_card.name=权限卡
item.refinedstorage:security_card.owner=绑定至:%s

View File

@@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "refinedstorage:items/wrench"
}
}

View File

@@ -1,19 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"EPE",
"EEE",
" E "
],
"key": {
"E": {
"item": "refinedstorage:quartz_enriched_iron"
},
"P": {
"item": "#basic_processor"
}
},
"result": {
"item": "refinedstorage:wrench"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB