mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
bedrock ore grade filters!
This commit is contained in:
parent
98aea38025
commit
b6d4e95ec9
@ -7,6 +7,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import com.hbm.interfaces.NotableComments;
|
||||
import com.hbm.inventory.container.ContainerAutocrafter;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAutocrafter;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -41,16 +42,7 @@ public class GUIAutocrafter extends GuiInfoContainer {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i);
|
||||
|
||||
if(this.isMouseOverSlot(slot, x, y) && diFurnace.matcher.modes[i] != null) {
|
||||
|
||||
String label = EnumChatFormatting.YELLOW + "";
|
||||
|
||||
switch(diFurnace.matcher.modes[i]) {
|
||||
case "exact": label += "Item and meta match"; break;
|
||||
case "wildcard": label += "Item matches"; break;
|
||||
default: label += "Ore dict key matches: " + diFurnace.matcher.modes[i]; break;
|
||||
}
|
||||
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", label }), x, y - 30);
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", ModulePatternMatcher.getLabel(diFurnace.matcher.modes[i]) }), x, y - 30);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerCounterTorch;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.NBTControlPacket;
|
||||
import com.hbm.tileentity.network.TileEntityRadioTorchCounter;
|
||||
@ -72,16 +73,7 @@ public class GUICounterTorch extends GuiInfoContainer {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i);
|
||||
|
||||
if(this.isMouseOverSlot(slot, x, y) && counter.matcher.modes[i] != null) {
|
||||
|
||||
String label = EnumChatFormatting.YELLOW + "";
|
||||
|
||||
switch(counter.matcher.modes[i]) {
|
||||
case "exact": label += "Item and meta match"; break;
|
||||
case "wildcard": label += "Item matches"; break;
|
||||
default: label += "Ore dict key matches: " + counter.matcher.modes[i]; break;
|
||||
}
|
||||
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", label }), x, y - 30);
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", ModulePatternMatcher.getLabel(counter.matcher.modes[i]) }), x, y - 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerCraneExtractor;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.NBTControlPacket;
|
||||
import com.hbm.tileentity.network.TileEntityCraneExtractor;
|
||||
@ -41,16 +42,7 @@ public class GUICraneExtractor extends GuiInfoContainer {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i);
|
||||
|
||||
if(this.isMouseOverSlot(slot, x, y) && ejector.matcher.modes[i] != null) {
|
||||
|
||||
String label = EnumChatFormatting.YELLOW + "";
|
||||
|
||||
switch(ejector.matcher.modes[i]) {
|
||||
case "exact": label += "Item and meta match"; break;
|
||||
case "wildcard": label += "Item matches"; break;
|
||||
default: label += "Ore dict key matches: " + ejector.matcher.modes[i]; break;
|
||||
}
|
||||
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", label }), x, y - 30);
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", ModulePatternMatcher.getLabel(ejector.matcher.modes[i]) }), x, y - 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerCraneGrabber;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toserver.NBTControlPacket;
|
||||
import com.hbm.tileentity.network.TileEntityCraneGrabber;
|
||||
@ -41,16 +42,7 @@ public class GUICraneGrabber extends GuiInfoContainer {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i);
|
||||
|
||||
if(this.isMouseOverSlot(slot, x, y) && grabber.matcher.modes[i] != null) {
|
||||
|
||||
String label = EnumChatFormatting.YELLOW + "";
|
||||
|
||||
switch(grabber.matcher.modes[i]) {
|
||||
case "exact": label += "Item and meta match"; break;
|
||||
case "wildcard": label += "Item matches"; break;
|
||||
default: label += "Ore dict key matches: " + grabber.matcher.modes[i]; break;
|
||||
}
|
||||
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", label }), x, y - 30);
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", ModulePatternMatcher.getLabel(grabber.matcher.modes[i]) }), x, y - 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,16 +83,7 @@ public class GUICraneRouter extends GuiInfoContainer {
|
||||
int index = i % 5;
|
||||
|
||||
if(this.isMouseOverSlot(slot, x, y) && matcher.modes[index] != null) {
|
||||
|
||||
String label = EnumChatFormatting.YELLOW + "";
|
||||
|
||||
switch(matcher.modes[index]) {
|
||||
case "exact": label += "Item and meta match"; break;
|
||||
case "wildcard": label += "Item matches"; break;
|
||||
default: label += "Ore dict key matches: " + matcher.modes[index]; break;
|
||||
}
|
||||
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", label}), x, y - 30);
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", ModulePatternMatcher.getLabel(matcher.modes[i])}), x, y - 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerDroneRequester;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
import com.hbm.tileentity.network.TileEntityDroneRequester;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -37,16 +38,7 @@ public class GUIDroneRequester extends GuiInfoContainer {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(i);
|
||||
|
||||
if(this.isMouseOverSlot(slot, x, y) && diFurnace.matcher.modes[i] != null) {
|
||||
|
||||
String label = EnumChatFormatting.YELLOW + "";
|
||||
|
||||
switch(diFurnace.matcher.modes[i]) {
|
||||
case "exact": label += "Item and meta match"; break;
|
||||
case "wildcard": label += "Item matches"; break;
|
||||
default: label += "Ore dict key matches: " + diFurnace.matcher.modes[i]; break;
|
||||
}
|
||||
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", label }), x, y - 30);
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", ModulePatternMatcher.getLabel(diFurnace.matcher.modes[i]) }), x, y - 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.hbm.inventory.SlotPattern;
|
||||
import com.hbm.inventory.container.ContainerMachineCustom;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.module.ModulePatternMatcher;
|
||||
import com.hbm.tileentity.machine.TileEntityCustomMachine;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -44,16 +45,7 @@ public class GUIMachineCustom extends GuiInfoContainer {
|
||||
int tileIndex = slot.getSlotIndex();
|
||||
|
||||
if(this.isMouseOverSlot(slot, x, y) && slot instanceof SlotPattern && custom.matcher.modes[tileIndex - 10] != null) {
|
||||
|
||||
String label = EnumChatFormatting.YELLOW + "";
|
||||
|
||||
switch(custom.matcher.modes[tileIndex - 10]) {
|
||||
case "exact": label += "Item and meta match"; break;
|
||||
case "wildcard": label += "Item matches"; break;
|
||||
default: label += "Ore dict key matches: " + custom.matcher.modes[tileIndex - 10]; break;
|
||||
}
|
||||
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", label }), x, y - 30);
|
||||
this.func_146283_a(Arrays.asList(new String[] { EnumChatFormatting.RED + "Right click to change", ModulePatternMatcher.getLabel(custom.matcher.modes[tileIndex - 10]) }), x, y - 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,18 +2,21 @@ package com.hbm.module;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.items.special.ItemBedrockOreNew;
|
||||
import com.hbm.util.BufferUtil;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ModulePatternMatcher {
|
||||
|
||||
public static final String MODE_EXACT = "exact";
|
||||
public static final String MODE_WILDCARD = "wildcard";
|
||||
public static final String MODE_BEDROCK = "bedrock";
|
||||
public String[] modes;
|
||||
|
||||
public ModulePatternMatcher() {
|
||||
@ -68,8 +71,10 @@ public class ModulePatternMatcher {
|
||||
modes[i] = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if(stack.getHasSubtypes()) {
|
||||
|
||||
if(stack.getItem() instanceof ItemBedrockOreNew) {
|
||||
modes[i] = MODE_BEDROCK;
|
||||
} else if(stack.getHasSubtypes()) {
|
||||
modes[i] = MODE_EXACT;
|
||||
} else {
|
||||
modes[i] = MODE_WILDCARD;
|
||||
@ -88,6 +93,12 @@ public class ModulePatternMatcher {
|
||||
if(modes[i] == null) {
|
||||
modes[i] = MODE_EXACT;
|
||||
} else if(MODE_EXACT.equals(modes[i])) {
|
||||
if(pattern.getItem() instanceof ItemBedrockOreNew) {
|
||||
modes[i] = MODE_BEDROCK;
|
||||
} else {
|
||||
modes[i] = MODE_WILDCARD;
|
||||
}
|
||||
} else if(MODE_BEDROCK.equals(modes[i])) {
|
||||
modes[i] = MODE_WILDCARD;
|
||||
} else if(MODE_WILDCARD.equals(modes[i])) {
|
||||
|
||||
@ -128,6 +139,10 @@ public class ModulePatternMatcher {
|
||||
switch(mode) {
|
||||
case MODE_EXACT: return input.isItemEqual(filter) && ItemStack.areItemStackTagsEqual(input, filter);
|
||||
case MODE_WILDCARD: return input.getItem() == filter.getItem() && ItemStack.areItemStackTagsEqual(input, filter);
|
||||
case MODE_BEDROCK:
|
||||
if(input.getItem() != filter.getItem()) return false;
|
||||
if(!(input.getItem() instanceof ItemBedrockOreNew)) return false;
|
||||
return ((ItemBedrockOreNew)input.getItem()).getGrade(input.getItemDamage()) == ((ItemBedrockOreNew)filter.getItem()).getGrade(filter.getItemDamage());
|
||||
default:
|
||||
List<String> keys = ItemStackUtil.getOreDictNames(input);
|
||||
return keys.contains(mode);
|
||||
@ -165,4 +180,14 @@ public class ModulePatternMatcher {
|
||||
modes[i] = BufferUtil.readString(buf);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getLabel(String mode) {
|
||||
switch(mode) {
|
||||
case MODE_EXACT: return EnumChatFormatting.YELLOW + "Item and meta match";
|
||||
case MODE_WILDCARD: return EnumChatFormatting.YELLOW + "Item matches";
|
||||
case MODE_BEDROCK: return EnumChatFormatting.YELLOW + "Item and bedrock grade match";
|
||||
default: return EnumChatFormatting.YELLOW + "Ore dict key matches: " + mode;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user