finishing touches

This commit is contained in:
70000hp 2024-08-29 20:12:58 -04:00
parent c135700d7e
commit ffcce8d9bb
8 changed files with 65 additions and 31 deletions

View File

@ -137,6 +137,7 @@ public class ToolRecipes {
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bismuth_tool, 1), new Object[] { "TBT", "SRS", "SCS", 'T', TA.nugget(), 'B', ModItems.nugget_bismuth, 'S', ANY_RESISTANTALLOY.ingot(), 'R', ModItems.reacher, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.CHIP) });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.sat_designator, 1), new Object[] { "RRD", "PIC", " P", 'P', GOLD.plate(), 'R', Items.redstone, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'D', ModItems.sat_chip, 'I', GOLD.ingot() });
CraftingManager.addShapelessAuto(new ItemStack(ModItems.sat_relay), new Object[] { ModItems.sat_chip, ModItems.ducttape, ModItems.radar_linker });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.settings_tool), new Object[] { " P ", "PCP", "III", 'P', IRON.plate(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ANALOG), 'I', ModItems.plate_polymer });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette, 1), new Object[] { " L", " G ", "G ", 'L', ANY_RUBBER.ingot(), 'G', KEY_CLEARGLASS});
CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette_boron, 1), new Object[] { " P", " B ", "B ", 'P', RUBBER.ingot(), 'B', ModBlocks.glass_boron});

View File

@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import javax.annotation.Nullable;
@ -48,9 +49,12 @@ public class ItemSettingsTool extends Item {
if(displayInfo.tagCount() > 0){
for (int j = 0; j < displayInfo.tagCount(); j++) {
NBTTagCompound nbt = displayInfo.getCompoundTagAt(j);
String info = nbt.getString("info");
EnumChatFormatting format = stack.stackTagCompound.getInteger("copyIndex") == j ? EnumChatFormatting.AQUA : EnumChatFormatting.YELLOW;
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(format + info, 897 + j, 4000 ), (EntityPlayerMP) entity);
PacketDispatcher.wrapper.sendTo(
new PlayerInformPacket(ChatBuilder.startTranslation(nbt.getString("info"))
.color(format)
.flush()
, 897 + j, 4000 ), (EntityPlayerMP) entity);
}
}
}
@ -61,12 +65,16 @@ public class ItemSettingsTool extends Item {
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
list.add("Can copy the settings (filters, fluid ID, etc) of machines");
list.add("Shift right-click to copy, right click to paste");
if(stack.stackTagCompound != null) {
/*if(stack.stackTagCompound != null) {
NBTTagCompound nbt = stack.stackTagCompound;
list.add(EnumChatFormatting.YELLOW + "Current machine:"
+ (nbt.hasKey("tileName") ? EnumChatFormatting.BLUE + " " + nbt.getString("tileName") : EnumChatFormatting.RED + " None "));
}
if (nbt.hasKey("tileName")){
list.add(ChatBuilder.startTranslation(nbt.getString("tileName")).color(EnumChatFormatting.BLUE).flush().getFormattedText());
} else {
list.add(EnumChatFormatting.RED + " None ");
}
}*/
//the translation wont fucking work I swear to allah
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
@ -76,25 +84,33 @@ public class ItemSettingsTool extends Item {
if(player.isSneaking()) {
stack.stackTagCompound = copiable.getSettings(world, x, y, z);
stack.stackTagCompound.setString("tileName", copiable.getSettingsSourceID(schrodinger));
stack.stackTagCompound.setInteger("copyIndex", 0);
stack.stackTagCompound.setInteger("inputDelay", 0);
String[] info = copiable.infoForDisplay(world, x, y, z);
if(info != null) {
NBTTagList displayInfo = new NBTTagList();
for (String str : info) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("info", str);
displayInfo.appendTag(nbt);
}
stack.stackTagCompound.setTag("displayInfo", displayInfo);
}
if(stack.stackTagCompound != null) {
if(world.isRemote) {
stack.stackTagCompound.setString("tileName", copiable.getSettingsSourceID(schrodinger));
stack.stackTagCompound.setInteger("copyIndex", 0);
stack.stackTagCompound.setInteger("inputDelay", 0);
String[] info = copiable.infoForDisplay(world, x, y, z);
if (info != null) {
NBTTagList displayInfo = new NBTTagList();
for (String str : info) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("info", str);
displayInfo.appendTag(nbt);
}
stack.stackTagCompound.setTag("displayInfo", displayInfo);
}
if (world.isRemote) {
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
.next("] ").color(EnumChatFormatting.DARK_AQUA)
.next("Copied settings of " + copiable.getSettingsSourceDisplay(schrodinger)).color(EnumChatFormatting.AQUA).flush());
}
} else {
player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA)
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
.next("] ").color(EnumChatFormatting.DARK_AQUA)
.next("Copied settings of " + copiable.getSettingsSourceDisplay(schrodinger)).color(EnumChatFormatting.AQUA).flush());
.nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA)
.next("] ").color(EnumChatFormatting.DARK_AQUA)
.next("Copy failed, machine has no settings tool support: " + copiable.getSettingsSourceDisplay(schrodinger)).color(EnumChatFormatting.RED).flush());
}
} else if(stack.hasTagCompound()) {

View File

@ -74,12 +74,16 @@ public interface IControlReceiverFilter extends IControlReceiver, ICopiable {
int listSize = items.tagCount();
if(listSize > 0) {
int count = 0;
for (int i = getFilterSlots()[0]; i < getFilterSlots()[1]; i++) {
if (i < listSize) {
NBTTagCompound slotNBT = items.getCompoundTagAt(count);
byte slot = slotNBT.getByte("slot");
ItemStack loadedStack = ItemStack.loadItemStackFromNBT(slotNBT);
if (loadedStack != null && slot < getFilterSlots()[1]) {
//whether the filter info came from a router
boolean router = nbt.hasKey("modes") && slot > index * 5 && slot < index * + 5;
if (loadedStack != null && index < listSize && (slot < getFilterSlots()[1] || router)) {
inv.setInventorySlotContents(slot + getFilterSlots()[0], ItemStack.loadItemStackFromNBT(slotNBT));
nextMode(slot);
tile.getWorldObj().markTileEntityChunkModified(tile.xCoord, tile.yCoord, tile.zCoord, tile);
@ -87,7 +91,6 @@ public interface IControlReceiverFilter extends IControlReceiver, ICopiable {
}
count++;
}
}
}

View File

@ -50,7 +50,7 @@ public interface IFluidCopiable extends ICopiable {
default void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
if(getTankToPaste() != null) {
int[] ids = nbt.getIntArray("fluidID");
if(ids.length > 0) {
if(ids.length > 0 && index < ids.length) {
int id = ids[index];
getTankToPaste().setTankType(Fluids.fromID(id));
}

View File

@ -19,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
public class TileEntityFoundryOutlet extends TileEntityFoundryBase implements ICopiable {
public class TileEntityFoundryOutlet extends TileEntityFoundryBase{
public NTMMaterial filter = null;
public NTMMaterial lastFilter = null;
@ -146,7 +146,7 @@ public class TileEntityFoundryOutlet extends TileEntityFoundryBase implements IC
if(nbt.hasKey("invertFilter")) this.invertFilter = nbt.getBoolean("invertFilter");
if(nbt.hasKey("matFilter")) {
int[] ids = nbt.getIntArray("matFilter");
if(ids.length > 0)
if(ids.length > 0 && index < ids.length)
this.filter = Mats.matById.get(ids[index]);
}
@ -155,8 +155,8 @@ public class TileEntityFoundryOutlet extends TileEntityFoundryBase implements IC
@Override
public String[] infoForDisplay(World world, int x, int y, int z) {
ArrayList<String> info = new ArrayList<>();
info.add("copyTool.invertRedstone");
info.add("copyTool.invertFilter");
info.add("copytool.invertRedstone");
info.add("copytool.invertFilter");
if (filter != null) info.add(filter.getUnlocalizedName());
return info.toArray(new String[0]);
}

View File

@ -160,7 +160,9 @@ public abstract class TileEntityCraneBase extends TileEntityMachineBase implemen
NBTTagCompound slotNBT = items.getCompoundTagAt(count);
byte slot = slotNBT.getByte("slot");
ItemStack loadedStack = ItemStack.loadItemStackFromNBT(slotNBT);
if (loadedStack != null && slot < filter.getFilterSlots()[1]) {
//whether the filter info came from a router
boolean router = nbt.hasKey("modes") && slot > index * 5 && slot < index * + 5;
if (loadedStack != null && (slot < filter.getFilterSlots()[1] || router)) {
inv.setInventorySlotContents(slot + filter.getFilterSlots()[0], ItemStack.loadItemStackFromNBT(slotNBT));
filter.nextMode(slot);
this.getWorldObj().markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);

View File

@ -181,6 +181,7 @@ public class TileEntityCraneRouter extends TileEntityMachineBase implements IGUI
this.getWorldObj().markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this);
}
}
modes = nbt.getIntArray("modes");
} else {
IControlReceiverFilter.super.pasteSettings(nbt, index, world, player, x, y, z);
}

View File

@ -858,6 +858,17 @@ container.wasteDrum=Spent Fuel Pool Drum
container.watzPowerplant=Watz Power Plant
container.zirnox=ZIRNOX Nuclear Reactor
copytool.filter=Filter
copytool.invertRedstone=Redstone Inverted
copytool.invertFilter=Filter Inverted
copytool.orientation=Orientation
copytool.pattern0=Red Side
copytool.pattern1=Orange Side
copytool.pattern2=Yellow Side
copytool.pattern3=Green Side
copytool.pattern4=Blue Side
copytool.pattern5=Purple Side
crucible.aa=Advanced Alloy Production
crucible.abronze=Arsenic Bronze Production
crucible.bbronze=Bismuth Bronze Production