mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 11:19:28 +00:00
Fix generics
This commit is contained in:
1 parent
68ab1b98bd
commit
331c8a8c7b
59 files changed
+129
-156
No files matched your search
@@ -12,12 +12,13 @@ import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.items.ItemBlockCandle;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
|
||||
public class BlockRegistryApiculture extends BlockRegistry {
|
||||
|
||||
public final BlockApiculture apiculture;
|
||||
public final BlockBase apicultureChest;
|
||||
public final BlockBase<? extends IMachineProperties> apicultureChest;
|
||||
public final BlockBeehives beehives;
|
||||
public final BlockCandle candle;
|
||||
public final BlockStump stump;
|
||||
@@ -26,7 +27,7 @@ public class BlockRegistryApiculture extends BlockRegistry {
|
||||
public BlockRegistryApiculture() {
|
||||
apiculture = registerBlock(new BlockApiculture(), ItemBlockForestry.class, "apiculture");
|
||||
|
||||
apicultureChest = registerBlock(new BlockBase(true), ItemBlockForestry.class, "apicultureChest");
|
||||
apicultureChest = registerBlock(new BlockBase<>(true), ItemBlockForestry.class, "apicultureChest");
|
||||
apicultureChest.setCreativeTab(Tabs.tabApiculture);
|
||||
apicultureChest.setHarvestLevel("axe", 0);
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static ComponentVillageBeeHouse buildComponent(StructureVillagePieces.Start startPiece, List par1List,
|
||||
Random random, int par3, int par4, int par5, int par6, int par7) {
|
||||
StructureBoundingBox bbox = StructureBoundingBox
|
||||
|
||||
@@ -28,7 +28,6 @@ import forestry.plugins.PluginApiculture;
|
||||
|
||||
public abstract class HiveDecorator {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final EventType EVENT_TYPE = EnumHelper
|
||||
.addEnum(EventType.class, "FORESTRY_HIVES", new Class[0], new Object[0]);
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@@ -50,29 +49,22 @@ public abstract class BlockStructure extends BlockForestry {
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof MultiblockTileEntityForestry)) {
|
||||
if (!(tile instanceof MultiblockTileEntityForestry<?>part)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MultiblockTileEntityForestry part = (MultiblockTileEntityForestry) tile;
|
||||
IMultiblockController controller = part.getMultiblockLogic().getController();
|
||||
|
||||
// If the player's hands are empty and they right-click on a multiblock, they get a
|
||||
// multiblock-debugging message if the machine is not assembled.
|
||||
if (player.getCurrentEquippedItem() == null && !controller.isAssembled()) {
|
||||
if (controller != null) {
|
||||
String validationError = controller.getLastValidationError();
|
||||
if (validationError != null) {
|
||||
long tick = world.getTotalWorldTime();
|
||||
if (tick > previousMessageTick + 20) {
|
||||
player.addChatMessage(new ChatComponentText(validationError));
|
||||
previousMessageTick = tick;
|
||||
}
|
||||
return true;
|
||||
String validationError = controller.getLastValidationError();
|
||||
if (validationError != null) {
|
||||
long tick = world.getTotalWorldTime();
|
||||
if (tick > previousMessageTick + 20) {
|
||||
player.addChatMessage(new ChatComponentText(validationError));
|
||||
previousMessageTick = tick;
|
||||
}
|
||||
} else {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(StatCollector.translateToLocal("for.multiblock.error.notConnected")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -94,13 +86,12 @@ public abstract class BlockStructure extends BlockForestry {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entityLiving instanceof EntityPlayer) {
|
||||
if (entityLiving instanceof EntityPlayer player) {
|
||||
TileEntity tile = world.getTileEntity(i, j, k);
|
||||
|
||||
if (tile instanceof MultiblockTileEntityForestry) {
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
if (tile instanceof MultiblockTileEntityForestry<?>tileForestry) {
|
||||
GameProfile gameProfile = player.getGameProfile();
|
||||
((MultiblockTileEntityForestry) tile).setOwner(gameProfile);
|
||||
tileForestry.setOwner(gameProfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ package forestry.core.blocks;
|
||||
|
||||
public interface IItemTyped {
|
||||
|
||||
Enum getTypeFromMeta(int meta);
|
||||
Enum<?> getTypeFromMeta(int meta);
|
||||
}
|
||||
@@ -109,6 +109,6 @@ public class CircuitRegistry implements ICircuitRegistry {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new CircuitBoard(nbttagcompound);
|
||||
return new CircuitBoard<>(nbttagcompound);
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,6 @@ public class GuiSolderingIron extends GuiForestry<ContainerSolderingIron, ItemIn
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ItemCircuitBoard extends ItemForestryMultiPass {
|
||||
|
||||
public static ItemStack createCircuitboard(EnumCircuitBoardType type, ICircuitLayout layout, ICircuit[] circuits) {
|
||||
ItemStack chipset = PluginCore.items.circuitboards.get(type);
|
||||
saveChipset(chipset, new CircuitBoard(type, layout, circuits));
|
||||
saveChipset(chipset, new CircuitBoard<>(type, layout, circuits));
|
||||
return chipset;
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,6 @@ public class CommandHelpers {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<String> getListOfStringsMatchingLastWord(String[] strings, String... lastWords) {
|
||||
return CommandBase.getListOfStringsMatchingLastWord(strings, lastWords);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class RootCommand extends CommandBase implements IForestryCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List addTabCompletionOptions(ICommandSender sender, String[] incomplete) {
|
||||
public List<String> addTabCompletionOptions(ICommandSender sender, String[] incomplete) {
|
||||
return CommandHelpers.addStandardTabCompletionOptions(this, sender, incomplete);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ public class ForestryGuiConfig extends GuiConfig {
|
||||
super(parent, getConfigCategories(), Constants.MOD, true, true, Constants.MOD);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static List<IConfigElement> getConfigCategories() {
|
||||
List<IConfigElement> configElements = new ArrayList<>();
|
||||
|
||||
@@ -32,13 +33,13 @@ public class ForestryGuiConfig extends GuiConfig {
|
||||
.asList("crafting", "difficulty", "genetics", "performance", "structures", "tweaks", "world");
|
||||
for (String categoryName : commonCategoryNames) {
|
||||
ConfigCategory category = Config.configCommon.getCategory(categoryName);
|
||||
configElements.add(new ConfigElement(category));
|
||||
configElements.add(new ConfigElement<>(category));
|
||||
}
|
||||
|
||||
List<String> fluidCategoryNames = Arrays.asList("enableFluid", "enableFluidBlock");
|
||||
for (String categoryName : fluidCategoryNames) {
|
||||
ConfigCategory category = Config.configFluid.getCategory(categoryName);
|
||||
configElements.add(new ConfigElement(category));
|
||||
configElements.add(new ConfigElement<>(category));
|
||||
}
|
||||
|
||||
return configElements;
|
||||
|
||||
@@ -10,7 +10,6 @@ package forestry.core.fluids;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -31,7 +30,7 @@ public class FakeTankManager implements ITankManager {
|
||||
public void containerAdded(Container container, ICrafting player) {}
|
||||
|
||||
@Override
|
||||
public void updateGuiData(Container container, List<EntityPlayerMP> crafters) {}
|
||||
public void updateGuiData(Container container, List<ICrafting> crafters) {}
|
||||
|
||||
@Override
|
||||
public void containerRemoved(Container container) {}
|
||||
|
||||
@@ -10,7 +10,6 @@ package forestry.core.fluids;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -21,7 +20,7 @@ public interface ITankManager extends IFluidHandler {
|
||||
|
||||
void containerAdded(Container container, ICrafting player);
|
||||
|
||||
void updateGuiData(Container container, List<EntityPlayerMP> crafters);
|
||||
void updateGuiData(Container container, List<ICrafting> crafters);
|
||||
|
||||
void containerRemoved(Container container);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -134,7 +135,7 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
|
||||
return;
|
||||
}
|
||||
|
||||
List<EntityPlayerMP> crafters = Collections.singletonList((EntityPlayerMP) player);
|
||||
List<ICrafting> crafters = Collections.singletonList(player);
|
||||
|
||||
for (StandardTank tank : tanks) {
|
||||
sendTankUpdate(container, tank, crafters);
|
||||
@@ -149,13 +150,13 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateGuiData(Container container, List<EntityPlayerMP> crafters) {
|
||||
public void updateGuiData(Container container, List<ICrafting> crafters) {
|
||||
for (StandardTank tank : tanks) {
|
||||
updateGuiData(container, crafters, tank.getTankIndex());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateGuiData(Container container, List<EntityPlayerMP> crafters, int tankIndex) {
|
||||
private void updateGuiData(Container container, List<ICrafting> crafters, int tankIndex) {
|
||||
StandardTank tank = tanks.get(tankIndex);
|
||||
if (tank == null) {
|
||||
return;
|
||||
@@ -170,12 +171,12 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
|
||||
sendTankUpdate(container, tank, crafters);
|
||||
}
|
||||
|
||||
private void sendTankUpdate(Container container, StandardTank tank, Iterable<EntityPlayerMP> crafters) {
|
||||
private void sendTankUpdate(Container container, StandardTank tank, Iterable<ICrafting> crafters) {
|
||||
int tankIndex = tank.getTankIndex();
|
||||
FluidStack fluid = tank.getFluid();
|
||||
IForestryPacketClient packet = new PacketTankLevelUpdate(tile, tankIndex, fluid);
|
||||
for (EntityPlayerMP player : crafters) {
|
||||
Proxies.net.sendToPlayer(packet, player);
|
||||
for (ICrafting player : crafters) {
|
||||
Proxies.net.sendToPlayer(packet, (EntityPlayer) player);
|
||||
}
|
||||
|
||||
if (fluid == null) {
|
||||
|
||||
@@ -33,7 +33,7 @@ public class AlleleHelper implements IAlleleHelper {
|
||||
private static final String modId = Constants.ID;
|
||||
public static AlleleHelper instance;
|
||||
|
||||
private final Map<Class, Map<?, ? extends IAllele>> alleleMaps = new HashMap<>();
|
||||
private final Map<Class<?>, Map<?, ? extends IAllele>> alleleMaps = new HashMap<>();
|
||||
|
||||
public void init() {
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
|
||||
@@ -38,7 +38,6 @@ public abstract class ContainerLiquidTanks<T extends TileEntity & ILiquidTankTil
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
tile.getTankManager().updateGuiData(this, crafters);
|
||||
|
||||
@@ -43,7 +43,6 @@ public abstract class ContainerLiquidTanksSocketed<T extends TileEntity & ILiqui
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
tile.getTankManager().updateGuiData(this, crafters);
|
||||
|
||||
@@ -302,7 +302,7 @@ public abstract class GuiForestry<C extends Container, I extends IInventory> ext
|
||||
@Optional.Method(modid = "NotEnoughItems")
|
||||
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
|
||||
if (gui instanceof GuiForestry) {
|
||||
return ((GuiForestry) gui).ledgerManager.ledgerOverlaps(x, y, w, h);
|
||||
return ((GuiForestry<?, ?>) gui).ledgerManager.ledgerOverlaps(x, y, w, h);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,6 @@ public class GuiNaturalistInventory extends GuiForestry<Container, IPagedInvento
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
@@ -70,7 +70,6 @@ public class GuiTextBox extends GuiTextField {
|
||||
return text.substring(0, cursorPos) + "_" + text.substring(cursorPos);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void drawScrolledSplitString(String text, int startX, int startY, int width, int textColour) {
|
||||
List<String> lines = fontRendererObj.listFormattedStringToWidth(text, width);
|
||||
maxLines = lines.size();
|
||||
|
||||
@@ -25,7 +25,7 @@ import forestry.core.gui.tooltips.ToolTipLine;
|
||||
|
||||
public class GuiUtil {
|
||||
|
||||
public static void drawItemStack(GuiForestry gui, ItemStack stack, int xPos, int yPos) {
|
||||
public static void drawItemStack(GuiForestry<?, ?> gui, ItemStack stack, int xPos, int yPos) {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
@@ -50,7 +50,7 @@ public class GuiUtil {
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
public static void drawToolTips(GuiForestry gui, ToolTip toolTips, int mouseX, int mouseY) {
|
||||
public static void drawToolTips(GuiForestry<?, ?> gui, ToolTip toolTips, int mouseX, int mouseY) {
|
||||
if (toolTips == null) {
|
||||
return;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public class GuiUtil {
|
||||
itemRender.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
public static void drawToolTips(GuiForestry gui, Collection<?> objects, int mouseX, int mouseY) {
|
||||
public static void drawToolTips(GuiForestry<?, ?> gui, Collection<?> objects, int mouseX, int mouseY) {
|
||||
for (Object obj : objects) {
|
||||
if (!(obj instanceof IToolTipProvider)) {
|
||||
continue;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
package forestry.core.gui;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -18,7 +20,7 @@ public class TextLayoutHelper {
|
||||
|
||||
private static final int LINE_HEIGHT = 12;
|
||||
|
||||
private final GuiForestry guiForestry;
|
||||
private final GuiForestry<? extends Container, ? extends IInventory> guiForestry;
|
||||
private final int defaultFontColor;
|
||||
private FontRenderer fontRendererObj;
|
||||
|
||||
@@ -27,7 +29,7 @@ public class TextLayoutHelper {
|
||||
public int column2;
|
||||
public int line;
|
||||
|
||||
public TextLayoutHelper(GuiForestry guiForestry, FontColour fontColour) {
|
||||
public TextLayoutHelper(GuiForestry<? extends Container, ? extends IInventory> guiForestry, FontColour fontColour) {
|
||||
this.guiForestry = guiForestry;
|
||||
this.defaultFontColor = fontColour.get("gui.screen");
|
||||
}
|
||||
|
||||
@@ -227,12 +227,10 @@ public abstract class Ledger {
|
||||
protected int drawSplitText(String string, int x, int y, int width, int color, boolean shadow) {
|
||||
int originalY = y;
|
||||
Minecraft minecraft = Proxies.common.getClientInstance();
|
||||
List strings = minecraft.fontRenderer.listFormattedStringToWidth(string, width);
|
||||
for (Object obj : strings) {
|
||||
if (obj instanceof String) {
|
||||
minecraft.fontRenderer.drawString((String) obj, x, y, color, shadow);
|
||||
y += minecraft.fontRenderer.FONT_HEIGHT;
|
||||
}
|
||||
List<String> strings = minecraft.fontRenderer.listFormattedStringToWidth(string, width);
|
||||
for (String obj : strings) {
|
||||
minecraft.fontRenderer.drawString(obj, x, y, color, shadow);
|
||||
y += minecraft.fontRenderer.FONT_HEIGHT;
|
||||
}
|
||||
return y - originalY;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ package forestry.core.gui.ledgers;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.api.core.IErrorSource;
|
||||
@@ -29,9 +32,9 @@ public class LedgerManager {
|
||||
private IErrorSource errorSource;
|
||||
private final int maxWidth;
|
||||
|
||||
public final GuiForestry gui;
|
||||
public final GuiForestry<? extends Container, ? extends IInventory> gui;
|
||||
|
||||
public LedgerManager(GuiForestry gui, int maxWidth) {
|
||||
public LedgerManager(GuiForestry<? extends Container, ? extends IInventory> gui, int maxWidth) {
|
||||
this.gui = gui;
|
||||
this.errorSource = FakeErrorSource.instance;
|
||||
this.maxWidth = maxWidth;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ToolTip extends ForwardingList<ToolTipLine> {
|
||||
return add(new ToolTipLine(line));
|
||||
}
|
||||
|
||||
public boolean add(List lines) {
|
||||
public boolean add(List<?> lines) {
|
||||
boolean changed = false;
|
||||
for (Object line : lines) {
|
||||
if (line instanceof String) {
|
||||
|
||||
@@ -54,7 +54,6 @@ public class SocketWidget extends Widget {
|
||||
|
||||
private final ToolTip toolTip = new ToolTip(250) {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void refresh() {
|
||||
toolTip.clear();
|
||||
|
||||
@@ -12,6 +12,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -20,11 +22,11 @@ import forestry.core.proxy.Proxies;
|
||||
|
||||
public class WidgetManager {
|
||||
|
||||
public final GuiForestry gui;
|
||||
public final GuiForestry<? extends Container, ? extends IInventory> gui;
|
||||
public final Minecraft minecraft;
|
||||
protected final List<Widget> widgets = new ArrayList<>();
|
||||
|
||||
public WidgetManager(GuiForestry gui) {
|
||||
public WidgetManager(GuiForestry<? extends Container, ? extends IInventory> gui) {
|
||||
this.gui = gui;
|
||||
this.minecraft = Proxies.common.getClientInstance();
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
coord);
|
||||
}
|
||||
|
||||
MultiblockLogic logic = (MultiblockLogic) part.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) part.getMultiblockLogic();
|
||||
|
||||
logic.setController(this);
|
||||
this.onBlockAdded(part);
|
||||
@@ -138,7 +138,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
TileEntity te = this.worldObj.getTileEntity(referenceCoord.posX, referenceCoord.posY, referenceCoord.posZ);
|
||||
if (te instanceof IMultiblockComponent) {
|
||||
IMultiblockComponent tePart = (IMultiblockComponent) te;
|
||||
MultiblockLogic teLogic = (MultiblockLogic) tePart.getMultiblockLogic();
|
||||
MultiblockLogic<?> teLogic = (MultiblockLogic<?>) tePart.getMultiblockLogic();
|
||||
teLogic.forfeitMultiblockSaveDelegate();
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
*/
|
||||
private void onDetachBlock(IMultiblockComponent part) {
|
||||
// Strip out this part
|
||||
MultiblockLogic logic = (MultiblockLogic) part.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) part.getMultiblockLogic();
|
||||
logic.setController(null);
|
||||
this.onBlockRemoved(part);
|
||||
logic.forfeitMultiblockSaveDelegate();
|
||||
@@ -361,7 +361,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
}
|
||||
|
||||
connectedParts.add(acquiredPart);
|
||||
MultiblockLogic logic = (MultiblockLogic) acquiredPart.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) acquiredPart.getMultiblockLogic();
|
||||
logic.setController(this);
|
||||
this.onBlockAdded(acquiredPart);
|
||||
}
|
||||
@@ -383,7 +383,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
.getTileEntity(referenceCoord.posX, referenceCoord.posY, referenceCoord.posZ);
|
||||
if (te instanceof IMultiblockComponent) {
|
||||
IMultiblockComponent part = (IMultiblockComponent) te;
|
||||
MultiblockLogic logic = (MultiblockLogic) part.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) part.getMultiblockLogic();
|
||||
logic.forfeitMultiblockSaveDelegate();
|
||||
}
|
||||
}
|
||||
@@ -745,7 +745,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
continue;
|
||||
}
|
||||
|
||||
MultiblockLogic logic = (MultiblockLogic) part.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) part.getMultiblockLogic();
|
||||
|
||||
logic.setUnvisited();
|
||||
logic.forfeitMultiblockSaveDelegate();
|
||||
@@ -769,7 +769,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
MultiblockRegistry.addDeadController(worldObj, this);
|
||||
return Collections.emptySet();
|
||||
} else {
|
||||
MultiblockLogic logic = (MultiblockLogic) referencePart.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) referencePart.getMultiblockLogic();
|
||||
logic.becomeMultiblockSaveDelegate();
|
||||
}
|
||||
|
||||
@@ -781,7 +781,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
|
||||
while (!partsToCheck.isEmpty()) {
|
||||
part = partsToCheck.removeFirst();
|
||||
MultiblockLogic partLogic = (MultiblockLogic) part.getMultiblockLogic();
|
||||
MultiblockLogic<?> partLogic = (MultiblockLogic<?>) part.getMultiblockLogic();
|
||||
partLogic.setVisited();
|
||||
|
||||
List<IMultiblockComponent> nearbyParts = MultiblockUtil.getNeighboringParts(worldObj, part); // Chunk-safe
|
||||
@@ -790,7 +790,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
// client
|
||||
for (IMultiblockComponent nearbyPart : nearbyParts) {
|
||||
// Ignore different machines
|
||||
MultiblockLogic nearbyPartLogic = (MultiblockLogic) nearbyPart.getMultiblockLogic();
|
||||
MultiblockLogic<?> nearbyPartLogic = (MultiblockLogic<?>) nearbyPart.getMultiblockLogic();
|
||||
if (nearbyPartLogic.getController() != this) {
|
||||
continue;
|
||||
}
|
||||
@@ -805,7 +805,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
// Finally, remove all parts that remain disconnected.
|
||||
Set<IMultiblockComponent> removedParts = new HashSet<>();
|
||||
for (IMultiblockComponent orphanCandidate : connectedParts) {
|
||||
MultiblockLogic logic = (MultiblockLogic) orphanCandidate.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) orphanCandidate.getMultiblockLogic();
|
||||
if (!logic.isVisited()) {
|
||||
deadParts.add(orphanCandidate);
|
||||
onDetachBlock(orphanCandidate);
|
||||
@@ -877,7 +877,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI
|
||||
}
|
||||
|
||||
if (theChosenOne != null) {
|
||||
MultiblockLogic logic = (MultiblockLogic) theChosenOne.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) theChosenOne.getMultiblockLogic();
|
||||
logic.becomeMultiblockSaveDelegate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class MultiblockWorldRegistry {
|
||||
if (compatibleControllers.size() == 0) {
|
||||
// FOREVER ALONE! Create and register a new controller.
|
||||
// THIS IS THE ONLY PLACE WHERE NEW CONTROLLERS ARE CREATED.
|
||||
MultiblockLogic logic = (MultiblockLogic) orphan.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) orphan.getMultiblockLogic();
|
||||
IMultiblockControllerInternal newController = logic.createNewController(worldObj);
|
||||
newController.attachBlock(orphan);
|
||||
this.controllers.add(newController);
|
||||
@@ -263,7 +263,7 @@ public class MultiblockWorldRegistry {
|
||||
// list, and will be checked next tick to see if their chunk is still loaded.
|
||||
for (IMultiblockComponent part : detachedParts) {
|
||||
// Ensure parts know they're detached
|
||||
MultiblockLogic logic = (MultiblockLogic) part.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) part.getMultiblockLogic();
|
||||
logic.assertDetached(part);
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ public class MultiblockWorldRegistry {
|
||||
Set<IMultiblockControllerInternal> controllers = new HashSet<>();
|
||||
IMultiblockControllerInternal bestController = null;
|
||||
|
||||
MultiblockLogic logic = (MultiblockLogic) part.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) part.getMultiblockLogic();
|
||||
Class<?> controllerClass = logic.getControllerClass();
|
||||
// Look for a compatible controller in our neighboring parts.
|
||||
List<IMultiblockComponent> partsToCheck = MultiblockUtil.getNeighboringParts(worldObj, part);
|
||||
@@ -367,7 +367,7 @@ public class MultiblockWorldRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
MultiblockLogic logic = (MultiblockLogic) part.getMultiblockLogic();
|
||||
MultiblockLogic<?> logic = (MultiblockLogic<?>) part.getMultiblockLogic();
|
||||
logic.assertDetached(part);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PacketGuiEnergy extends ForestryPacket implements IForestryPacketCl
|
||||
@Override
|
||||
public void onPacketData(DataInputStreamForestry data, EntityPlayer player) throws IOException {
|
||||
if (player.openContainer instanceof ContainerTile && player.openContainer.windowId == windowId) {
|
||||
((ContainerTile) player.openContainer).onGuiEnergy(value);
|
||||
((ContainerTile<?>) player.openContainer).onGuiEnergy(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import forestry.factory.inventory.InventoryCraftingForestry;
|
||||
|
||||
public abstract class RecipeUtil {
|
||||
|
||||
static List<Object> cachedRecipes = new ArrayList<Object>();
|
||||
static List<IRecipe> cachedRecipes = new ArrayList<>();
|
||||
|
||||
public static void addFermenterRecipes(ItemStack resource, int fermentationValue, Fluids output) {
|
||||
if (RecipeManagers.fermenterManager == null) {
|
||||
@@ -183,15 +183,14 @@ public abstract class RecipeUtil {
|
||||
}
|
||||
|
||||
List<ItemStack> matchingRecipes = new ArrayList<>();
|
||||
List<Integer> matchingIndex = new ArrayList();
|
||||
List<Object> matchingRecipeMap = new ArrayList();
|
||||
List<Integer> matchingIndex = new ArrayList<>();
|
||||
List<IRecipe> matchingRecipeMap = new ArrayList<>();
|
||||
int index = 0;
|
||||
|
||||
if (Config.cacheWorktableRecipes) {
|
||||
// Check across the whole cached recipe map
|
||||
// Add each recipe to the matchingRecipes list
|
||||
for (Object recipe : cachedRecipes) {
|
||||
IRecipe irecipe = (IRecipe) recipe;
|
||||
for (IRecipe irecipe : cachedRecipes) {
|
||||
|
||||
if (irecipe.matches(inventory, world)) {
|
||||
ItemStack result = irecipe.getCraftingResult(inventory);
|
||||
@@ -206,8 +205,7 @@ public abstract class RecipeUtil {
|
||||
}
|
||||
}
|
||||
// Only do this if there were no cached recipes hit
|
||||
for (Object recipe : CraftingManager.getInstance().getRecipeList()) {
|
||||
IRecipe irecipe = (IRecipe) recipe;
|
||||
for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
|
||||
|
||||
if (irecipe.matches(inventory, world)) {
|
||||
ItemStack result = irecipe.getCraftingResult(inventory);
|
||||
@@ -216,8 +214,8 @@ public abstract class RecipeUtil {
|
||||
if (Config.promoteWorktableRecipesToFrontOfGlobalRecipemap || Config.cacheWorktableRecipes) {
|
||||
// Add to the back of the list. That way when we cycle through the list
|
||||
// moving items to the front, the index locations for the following items doesn't change
|
||||
matchingRecipeMap.add(recipe);
|
||||
matchingIndex.add(new Integer(index));
|
||||
matchingRecipeMap.add(irecipe);
|
||||
matchingIndex.add(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,7 +225,7 @@ public abstract class RecipeUtil {
|
||||
if (Config.promoteWorktableRecipesToFrontOfGlobalRecipemap) {
|
||||
// Only move the recipes if the last one was beyond 500 in the recipeMap (in GTNH about 57k recipes)
|
||||
if (matchingIndex.get(matchingIndex.size() - 1) > 500) {
|
||||
List recipeMap = CraftingManager.getInstance().getRecipeList();
|
||||
List<IRecipe> recipeMap = CraftingManager.getInstance().getRecipeList();
|
||||
// System.out.println( "Highest recipe found at " + matchingIndex.get(matchingIndex.size()-1) + ",
|
||||
// moving " + matchingIndex.size() + " to front" );
|
||||
// System.out.println( "Size of recipe map " + recipeMap.size() );
|
||||
@@ -295,12 +293,10 @@ public abstract class RecipeUtil {
|
||||
addRecipe(new ItemStack(item), obj);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addRecipe(ItemStack itemstack, Object... obj) {
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedRecipeCustom(itemstack, obj));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addPriorityRecipe(ItemStack itemStack, Object... obj) {
|
||||
CraftingManager.getInstance().getRecipeList().add(0, new ShapedRecipeCustom(itemStack, obj));
|
||||
}
|
||||
@@ -309,7 +305,6 @@ public abstract class RecipeUtil {
|
||||
addShapelessRecipe(new ItemStack(item), obj);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addShapelessRecipe(ItemStack itemstack, Object... obj) {
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(itemstack, obj));
|
||||
}
|
||||
@@ -400,7 +395,7 @@ public abstract class RecipeUtil {
|
||||
} else if (recipeIngredient instanceof ItemStack) {
|
||||
return ItemStackUtil.isCraftingEquivalent((ItemStack) recipeIngredient, resource);
|
||||
} else if (recipeIngredient instanceof Iterable) {
|
||||
for (Object item : (Iterable) recipeIngredient) {
|
||||
for (Object item : (Iterable<?>) recipeIngredient) {
|
||||
if (checkIngredientMatch(item, resource)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class PositionedStackAdv extends PositionedStack {
|
||||
return new Rectangle(this.relx - 1, this.rely - 1, 18, 18);
|
||||
}
|
||||
|
||||
public List<String> handleTooltip(GuiRecipe guiRecipe, List<String> currenttip) {
|
||||
public List<String> handleTooltip(GuiRecipe<?> guiRecipe, List<String> currenttip) {
|
||||
if (!this.tooltip.isEmpty()) {
|
||||
for (String tip : this.tooltip) {
|
||||
currenttip.add(tip);
|
||||
|
||||
@@ -139,7 +139,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler implements
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public List<String> provideTooltip(GuiRecipe guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe,
|
||||
public List<String> provideTooltip(GuiRecipe<?> guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe,
|
||||
Point relMouse) {
|
||||
if (crecipe.getFluidTanks() != null) {
|
||||
for (PositionedFluidTank tank : crecipe.getFluidTanks()) {
|
||||
@@ -151,7 +151,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler implements
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public List<String> provideItemTooltip(GuiRecipe guiRecipe, ItemStack itemStack, List<String> currenttip,
|
||||
public List<String> provideItemTooltip(GuiRecipe<?> guiRecipe, ItemStack itemStack, List<String> currenttip,
|
||||
CachedBaseRecipe crecipe, Point relMouse) {
|
||||
for (PositionedStack stack : crecipe.getIngredients()) {
|
||||
if (stack instanceof PositionedStackAdv && ((PositionedStackAdv) stack).getRect().contains(relMouse)) {
|
||||
@@ -171,7 +171,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) {
|
||||
public boolean keyTyped(GuiRecipe<?> gui, char keyChar, int keyCode, int recipe) {
|
||||
if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) {
|
||||
if (this.transferFluidTank(gui, recipe, false)) {
|
||||
return true;
|
||||
@@ -185,7 +185,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiRecipe gui, int button, int recipe) {
|
||||
public boolean mouseClicked(GuiRecipe<?> gui, int button, int recipe) {
|
||||
if (button == 0) {
|
||||
if (this.transferFluidTank(gui, recipe, false)) {
|
||||
return true;
|
||||
@@ -198,7 +198,7 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler implements
|
||||
return super.mouseClicked(gui, button, recipe);
|
||||
}
|
||||
|
||||
protected boolean transferFluidTank(GuiRecipe guiRecipe, int recipe, boolean usage) {
|
||||
protected boolean transferFluidTank(GuiRecipe<?> guiRecipe, int recipe, boolean usage) {
|
||||
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
|
||||
Point mousepos = GuiDraw.getMousePosition();
|
||||
Point offset = guiRecipe.getRecipePosition(recipe);
|
||||
|
||||
@@ -31,6 +31,7 @@ import forestry.core.config.Constants;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public abstract class BlockUtil {
|
||||
|
||||
private static final int slabWoodId = OreDictionary.getOreID("slabWood");
|
||||
|
||||
@@ -59,13 +59,11 @@ public abstract class EntityUtil {
|
||||
Log.finer("Registered entity %s (%s) with id %s.", ident, entityClass.toString(), id);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends Entity> List<T> getEntitiesWithinAABB(World world, Class<T> entityClass,
|
||||
AxisAlignedBB boundingBox) {
|
||||
return world.getEntitiesWithinAABB(entityClass, boundingBox);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends Entity> List<T> selectEntitiesWithinAABB(World world, EntitySelector<T> entitySelector,
|
||||
AxisAlignedBB boundingBox) {
|
||||
return world.selectEntitiesWithinAABB(entitySelector.getEntityClass(), boundingBox, entitySelector);
|
||||
|
||||
@@ -123,7 +123,7 @@ public abstract class Log {
|
||||
LogManager.getLogger(Constants.MOD).log(level, new MessageFormatMessage(msg, args), error);
|
||||
}
|
||||
|
||||
public static void logErrorAPI(String mod, Throwable error, Class classFile) {
|
||||
public static void logErrorAPI(String mod, Throwable error, Class<?> classFile) {
|
||||
StringBuilder msg = new StringBuilder(mod);
|
||||
msg.append(" API error, please update your mods. Error: ").append(error);
|
||||
logThrowable(Level.ERROR, msg.toString(), 2, error);
|
||||
|
||||
@@ -62,8 +62,8 @@ public abstract class SlotUtil {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static ItemStack transferStackInSlot(List inventorySlots, EntityPlayer player, int slotIndex) {
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
public static ItemStack transferStackInSlot(List<Slot> inventorySlots, EntityPlayer player, int slotIndex) {
|
||||
Slot slot = inventorySlots.get(slotIndex);
|
||||
if (slot == null || !slot.getHasStack()) {
|
||||
return null;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public abstract class SlotUtil {
|
||||
return originalStack;
|
||||
}
|
||||
|
||||
private static boolean shiftItemStack(List inventorySlots, ItemStack stackInSlot, int slotIndex, int numSlots,
|
||||
private static boolean shiftItemStack(List<Slot> inventorySlots, ItemStack stackInSlot, int slotIndex, int numSlots,
|
||||
boolean fromCraftingSlot) {
|
||||
if (isInPlayerInventory(slotIndex)) {
|
||||
if (shiftToMachineInventory(inventorySlots, stackInSlot, numSlots)) {
|
||||
@@ -160,13 +160,14 @@ public abstract class SlotUtil {
|
||||
slot.putStack(phantomStack);
|
||||
}
|
||||
|
||||
private static boolean shiftItemStackToRange(List inventorySlots, ItemStack stackToShift, int start, int count) {
|
||||
private static boolean shiftItemStackToRange(List<Slot> inventorySlots, ItemStack stackToShift, int start,
|
||||
int count) {
|
||||
boolean changed = shiftItemStackToRangeMerge(inventorySlots, stackToShift, start, count);
|
||||
changed |= shiftItemStackToRangeOpenSlots(inventorySlots, stackToShift, start, count);
|
||||
return changed;
|
||||
}
|
||||
|
||||
private static boolean shiftItemStackToRangeMerge(List inventorySlots, ItemStack stackToShift, int start,
|
||||
private static boolean shiftItemStackToRangeMerge(List<Slot> inventorySlots, ItemStack stackToShift, int start,
|
||||
int count) {
|
||||
if (stackToShift == null || !stackToShift.isStackable() || stackToShift.stackSize <= 0) {
|
||||
return false;
|
||||
@@ -174,7 +175,7 @@ public abstract class SlotUtil {
|
||||
|
||||
boolean changed = false;
|
||||
for (int slotIndex = start; stackToShift.stackSize > 0 && slotIndex < start + count; slotIndex++) {
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
Slot slot = inventorySlots.get(slotIndex);
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
if (stackInSlot != null && ItemStackUtil.isIdenticalItem(stackInSlot, stackToShift)) {
|
||||
int resultingStackSize = stackInSlot.stackSize + stackToShift.stackSize;
|
||||
@@ -195,7 +196,7 @@ public abstract class SlotUtil {
|
||||
return changed;
|
||||
}
|
||||
|
||||
private static boolean shiftItemStackToRangeOpenSlots(List inventorySlots, ItemStack stackToShift, int start,
|
||||
private static boolean shiftItemStackToRangeOpenSlots(List<Slot> inventorySlots, ItemStack stackToShift, int start,
|
||||
int count) {
|
||||
if (stackToShift == null || stackToShift.stackSize <= 0) {
|
||||
return false;
|
||||
@@ -203,7 +204,7 @@ public abstract class SlotUtil {
|
||||
|
||||
boolean changed = false;
|
||||
for (int slotIndex = start; stackToShift.stackSize > 0 && slotIndex < start + count; slotIndex++) {
|
||||
Slot slot = (Slot) inventorySlots.get(slotIndex);
|
||||
Slot slot = inventorySlots.get(slotIndex);
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
if (stackInSlot == null) {
|
||||
int max = Math.min(stackToShift.getMaxStackSize(), slot.getSlotStackLimit());
|
||||
@@ -229,7 +230,7 @@ public abstract class SlotUtil {
|
||||
return SlotUtil.isSlotInRange(slotIndex, playerInventorySize - playerHotbarSize, playerInventorySize);
|
||||
}
|
||||
|
||||
private static boolean shiftToPlayerInventory(List inventorySlots, ItemStack stackInSlot) {
|
||||
private static boolean shiftToPlayerInventory(List<Slot> inventorySlots, ItemStack stackInSlot) {
|
||||
int playerHotbarStart = playerInventorySize - playerHotbarSize;
|
||||
|
||||
// try to merge with existing stacks, hotbar first
|
||||
@@ -242,17 +243,17 @@ public abstract class SlotUtil {
|
||||
return shifted;
|
||||
}
|
||||
|
||||
private static boolean shiftToPlayerInventoryNoHotbar(List inventorySlots, ItemStack stackInSlot) {
|
||||
private static boolean shiftToPlayerInventoryNoHotbar(List<Slot> inventorySlots, ItemStack stackInSlot) {
|
||||
int playerHotbarStart = playerInventorySize - playerHotbarSize;
|
||||
return shiftItemStackToRange(inventorySlots, stackInSlot, 0, playerHotbarStart);
|
||||
}
|
||||
|
||||
private static boolean shiftToHotbar(List inventorySlots, ItemStack stackInSlot) {
|
||||
private static boolean shiftToHotbar(List<Slot> inventorySlots, ItemStack stackInSlot) {
|
||||
int playerHotbarStart = playerInventorySize - playerHotbarSize;
|
||||
return shiftItemStackToRange(inventorySlots, stackInSlot, playerHotbarStart, playerHotbarSize);
|
||||
}
|
||||
|
||||
private static boolean shiftToMachineInventory(List inventorySlots, ItemStack stackToShift, int numSlots) {
|
||||
private static boolean shiftToMachineInventory(List<Slot> inventorySlots, ItemStack stackToShift, int numSlots) {
|
||||
boolean success = false;
|
||||
if (stackToShift.isStackable()) {
|
||||
success = shiftToMachineInventory(inventorySlots, stackToShift, numSlots, true);
|
||||
@@ -264,7 +265,7 @@ public abstract class SlotUtil {
|
||||
}
|
||||
|
||||
// if mergeOnly = true, don't shift into empty slots.
|
||||
private static boolean shiftToMachineInventory(List inventorySlots, ItemStack stackToShift, int numSlots,
|
||||
private static boolean shiftToMachineInventory(List<Slot> inventorySlots, ItemStack stackToShift, int numSlots,
|
||||
boolean mergeOnly) {
|
||||
for (int machineIndex = playerInventorySize; machineIndex < numSlots; machineIndex++) {
|
||||
// System.out.println("SlotUtil::shiftToMachineinventory");
|
||||
|
||||
@@ -67,8 +67,7 @@ public class BlockEngine extends BlockBase<BlockEngineType> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, List list,
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, List<AxisAlignedBB> list,
|
||||
Entity colliding) {
|
||||
TileEngine tile = TileUtil.getTile(world, x, y, z, TileEngine.class);
|
||||
if (tile == null) {
|
||||
|
||||
@@ -32,7 +32,6 @@ public class ContainerEngineBiogas extends ContainerLiquidTanks<TileEngineBiogas
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ public class ContainerGenerator extends ContainerLiquidTanks<TileGenerator> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
|
||||
@@ -69,7 +69,6 @@ public class ContainerFabricator extends ContainerLiquidTanks<TileFabricator> im
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ public class ContainerFermenter extends ContainerLiquidTanks<TileFermenter> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ public class ContainerMoistener extends ContainerLiquidTanks<TileMoistener> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ public class ContainerRaintank extends ContainerLiquidTanks<TileRaintank> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
|
||||
@@ -111,7 +111,6 @@ public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWork
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void addButtons() {
|
||||
buttonList.add(new GuiBetterButton(0, guiLeft + 76, guiTop + 56, StandardButtonTextureSets.LEFT_BUTTON_SMALL));
|
||||
buttonList.add(new GuiBetterButton(1, guiLeft + 85, guiTop + 56, StandardButtonTextureSets.RIGHT_BUTTON_SMALL));
|
||||
|
||||
@@ -85,7 +85,7 @@ public class NEIHandlerCarpenter extends RecipeHandlerBase {
|
||||
continue;
|
||||
} else if (item instanceof ItemStack[] && ((ItemStack[]) item).length == 0) {
|
||||
continue;
|
||||
} else if (item instanceof List && ((List) item).size() == 0) {
|
||||
} else if (item instanceof List && ((List<?>) item).size() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public class NEIHandlerFabricator extends RecipeHandlerBase {
|
||||
continue;
|
||||
} else if (item instanceof ItemStack[] && ((ItemStack[]) item).length == 0) {
|
||||
continue;
|
||||
} else if (item instanceof List && ((List) item).size() == 0) {
|
||||
} else if (item instanceof List && ((List<?>) item).size() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ public class NEIHandlerFabricator extends RecipeHandlerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> provideItemTooltip(GuiRecipe guiRecipe, ItemStack itemStack, List<String> currenttip,
|
||||
public List<String> provideItemTooltip(GuiRecipe<?> guiRecipe, ItemStack itemStack, List<String> currenttip,
|
||||
CachedBaseRecipe crecipe, Point relMouse) {
|
||||
super.provideItemTooltip(guiRecipe, itemStack, currenttip, crecipe, relMouse);
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class TileCarpenter extends TilePowered
|
||||
|
||||
private final FilteredTank resourceTank;
|
||||
private final TankManager tankManager;
|
||||
private final InventoryAdapterTile craftingInventory;
|
||||
private final InventoryAdapterTile<?> craftingInventory;
|
||||
private final InventoryCraftResult craftPreviewInventory;
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -56,7 +56,7 @@ public class TileFabricator extends TilePowered
|
||||
|
||||
private static final int MAX_HEAT = 5000;
|
||||
|
||||
private final InventoryAdapterTile craftingInventory;
|
||||
private final InventoryAdapterTile<?> craftingInventory;
|
||||
private final TankManager tankManager;
|
||||
private final FilteredTank moltenTank;
|
||||
private int heat = 0;
|
||||
|
||||
@@ -38,7 +38,7 @@ import forestry.factory.recipes.RecipeMemory;
|
||||
public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
|
||||
private final RecipeMemory recipeMemory;
|
||||
private final InventoryAdapterTile craftingDisplay;
|
||||
private final InventoryAdapterTile<?> craftingDisplay;
|
||||
private MemorizedRecipe currentRecipe;
|
||||
private long savedTick = 0;
|
||||
private long savedSystemTimeExpiration = 0;
|
||||
|
||||
@@ -42,7 +42,6 @@ public class CircuitFarmLogic extends Circuit {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void onInsertion(int slot, Object tile) {
|
||||
IFarmHousing housing = getCircuitable(tile);
|
||||
if (housing == null) {
|
||||
|
||||
@@ -89,6 +89,7 @@ public class ItemButterflyGE extends ItemGE {
|
||||
return butterfly.getDisplayName();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) {
|
||||
super.addInformation(itemstack, player, list, flag);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class LetterProperties {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
public static void getSubItems(Item item, CreativeTabs tab, @SuppressWarnings("rawtypes") List list) {
|
||||
for (State state : State.values()) {
|
||||
for (Size size : Size.values()) {
|
||||
int meta = encodeMeta(state, size);
|
||||
|
||||
@@ -43,7 +43,6 @@ public class GuiCatalogue extends GuiForestry<ContainerCatalogue, IInventory> {
|
||||
this.ySize = 192;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
@@ -82,7 +82,7 @@ public class ItemLetter extends ItemWithGui {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
public void getSubItems(Item item, CreativeTabs tab, @SuppressWarnings("rawtypes") List list) {
|
||||
LetterProperties.getSubItems(item, tab, list);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import forestry.api.fuels.FermenterFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.fuels.MoistenerFuel;
|
||||
import forestry.api.fuels.RainSubstrate;
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.core.blocks.BlockCoreType;
|
||||
@@ -78,7 +77,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
protected void setupAPI() {
|
||||
super.setupAPI();
|
||||
|
||||
RecipeManagers.craftingProviders = ImmutableList.<ICraftingProvider>of(
|
||||
RecipeManagers.craftingProviders = ImmutableList.of(
|
||||
RecipeManagers.carpenterManager = new CarpenterRecipeManager(),
|
||||
RecipeManagers.centrifugeManager = new CentrifugeRecipeManager(),
|
||||
RecipeManagers.fabricatorManager = new FabricatorRecipeManager(),
|
||||
@@ -95,7 +94,7 @@ public class PluginFactory extends ForestryPlugin {
|
||||
protected void disabledSetupAPI() {
|
||||
super.disabledSetupAPI();
|
||||
|
||||
RecipeManagers.craftingProviders = ImmutableList.<ICraftingProvider>of(
|
||||
RecipeManagers.craftingProviders = ImmutableList.of(
|
||||
RecipeManagers.carpenterManager = new DummyManagers.DummyCarpenterManager(),
|
||||
RecipeManagers.centrifugeManager = new DummyManagers.DummyCentrifugeManager(),
|
||||
RecipeManagers.fabricatorManager = new DummyManagers.DummyFabricatorManager(),
|
||||
|
||||
@@ -131,7 +131,6 @@ public class PluginLepidopterology extends ForestryPlugin {
|
||||
config.save();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
CraftingManager.getInstance().getRecipeList().add(new MatingRecipe());
|
||||
|
||||
@@ -100,7 +100,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
public static ItemRegistryStorage items;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
protected void setupAPI() {
|
||||
super.setupAPI();
|
||||
|
||||
@@ -149,7 +149,7 @@ public class PluginStorage extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
protected void disabledSetupAPI() {
|
||||
BackpackManager.backpackItems = new ArrayList[6];
|
||||
BackpackManager.backpackItems[0] = minerItems;
|
||||
@@ -186,12 +186,12 @@ public class PluginStorage extends ForestryPlugin {
|
||||
config.save();
|
||||
|
||||
BackpackDefinition forester = (BackpackDefinition) BackpackManager.definitions.get("forester");
|
||||
forester.addValidBlockClasses(Arrays.<Class>asList(IPlantable.class, IGrowable.class, IShearable.class));
|
||||
forester.addValidItemClasses(Arrays.<Class>asList(IPlantable.class, IGrowable.class));
|
||||
forester.addValidBlockClasses(Arrays.asList(IPlantable.class, IGrowable.class, IShearable.class));
|
||||
forester.addValidItemClasses(Arrays.asList(IPlantable.class, IGrowable.class));
|
||||
|
||||
BackpackDefinition builder = (BackpackDefinition) BackpackManager.definitions.get("builder");
|
||||
builder.addValidBlockClasses(
|
||||
Arrays.<Class>asList(
|
||||
Arrays.asList(
|
||||
BlockStairs.class,
|
||||
BlockFence.class,
|
||||
BlockFenceGate.class,
|
||||
|
||||
@@ -33,8 +33,8 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
|
||||
private final Set<String> validItemStacks = new HashSet<>();
|
||||
private final Set<Integer> validOreIds = new HashSet<>();
|
||||
private final Set<Class> validItemClasses = new HashSet<>();
|
||||
private final Set<Class> validBlockClasses = new HashSet<>();
|
||||
private final Set<Class<?>> validItemClasses = new HashSet<>();
|
||||
private final Set<Class<?>> validBlockClasses = new HashSet<>();
|
||||
|
||||
public BackpackDefinition(String name, int primaryColor) {
|
||||
this(name, primaryColor, 0xffffff);
|
||||
@@ -125,26 +125,26 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
public void addValidItemClass(Class itemClass) {
|
||||
public void addValidItemClass(Class<?> itemClass) {
|
||||
if (itemClass != null) {
|
||||
validItemClasses.add(itemClass);
|
||||
}
|
||||
}
|
||||
|
||||
public void addValidItemClasses(List<Class> itemClasses) {
|
||||
for (Class itemClass : itemClasses) {
|
||||
public void addValidItemClasses(List<Class<?>> itemClasses) {
|
||||
for (Class<?> itemClass : itemClasses) {
|
||||
addValidItemClass(itemClass);
|
||||
}
|
||||
}
|
||||
|
||||
public void addValidBlockClass(Class blockClass) {
|
||||
public void addValidBlockClass(Class<?> blockClass) {
|
||||
if (blockClass != null) {
|
||||
validBlockClasses.add(blockClass);
|
||||
}
|
||||
}
|
||||
|
||||
public void addValidBlockClasses(List<Class> blockClasses) {
|
||||
for (Class blockClass : blockClasses) {
|
||||
public void addValidBlockClasses(List<Class<?>> blockClasses) {
|
||||
for (Class<?> blockClass : blockClasses) {
|
||||
addValidBlockClass(blockClass);
|
||||
}
|
||||
}
|
||||
@@ -157,11 +157,11 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
return validOreIds;
|
||||
}
|
||||
|
||||
public Set<Class> getValidBlockClasses() {
|
||||
public Set<Class<?>> getValidBlockClasses() {
|
||||
return validBlockClasses;
|
||||
}
|
||||
|
||||
public Set<Class> getValidItemClasses() {
|
||||
public Set<Class<?>> getValidItemClasses() {
|
||||
return validItemClasses;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
for (Class itemClass : validItemClasses) {
|
||||
for (Class<?> itemClass : validItemClasses) {
|
||||
if (itemClass.isInstance(item)) {
|
||||
validItemStacks.add(itemStackStringWild);
|
||||
return true;
|
||||
@@ -206,7 +206,7 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
|
||||
Block block = Block.getBlockFromItem(item);
|
||||
if (block != null) {
|
||||
for (Class blockClass : validBlockClasses) {
|
||||
for (Class<?> blockClass : validBlockClasses) {
|
||||
if (blockClass.isInstance(block)) {
|
||||
validItemStacks.add(itemStackStringWild);
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user