diff --git a/gradle.properties b/gradle.properties index 75b01ffc9..d2a293769 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ -mcversion=1.8.9 -forgeversion=11.15.1.1855 -mcp_mappings=snapshot_20160223 +mcversion=1.9 +forgeversion=12.16.0.1868-1.9 +mcp_mappings=snapshot_20160430 -jei_version=2.28.18.+ +jei_version=3.3.3.+ ic2_version=2.3.235-ex18 version_major=5 diff --git a/src/api/java/buildcraft/api/APIHelper.java b/src/api/java/buildcraft/api/APIHelper.java deleted file mode 100644 index dd47dcc7c..000000000 --- a/src/api/java/buildcraft/api/APIHelper.java +++ /dev/null @@ -1,79 +0,0 @@ -package buildcraft.api; - -import java.util.Arrays; - -import org.apache.commons.lang3.StringUtils; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.LoaderState; - -import buildcraft.api.core.BCLog; - -public class APIHelper { - public static T getInstance(String clsName, Class baseVersion) { - return getNamedInstance(clsName, "INSTANCE", baseVersion); - } - - public static T getInstance(String clsName, Class baseVersion, T nullVersion) { - return getNamedInstance(clsName, "INSTANCE", baseVersion, nullVersion); - } - - @SuppressWarnings("unchecked") - public static T getNamedInstance(String clsName, String enumName, Class baseVersion) { - T instance = getNamedInstance(clsName, enumName, baseVersion, null); - if (instance != null) return instance; - - Class[] types = baseVersion.getClasses(); - Class voidType = null; - for (Class class1 : types) { - if (baseVersion.isAssignableFrom(class1)) voidType = class1; - } - if (voidType != null) { - Object[] arr = voidType.getEnumConstants(); - if (arr == null) return null; - Enum[] eArr = ((Class>) voidType).getEnumConstants(); - for (Enum e : eArr) { - if (e.name().equals(enumName) && baseVersion.isInstance(e)) return (T) e; - } - } - return null; - } - - @SuppressWarnings("unchecked") - public static T getNamedInstance(String clsName, String enumName, Class baseVersion, T nullVersion) { - if (!Loader.instance().hasReachedState(LoaderState.PREINITIALIZATION)) throw new IllegalStateException( - "Called this API too early, you are not allowed to use BC api before pre init!"); - try { - Class cls = Class.forName(clsName); - Object[] arr = cls.getEnumConstants(); - if (arr == null) { - return fail(clsName, nullVersion); - } - Enum[] enumArr = ((Class>) cls).getEnumConstants(); - - for (Enum e : enumArr) { - if (e.name().equals(enumName) && baseVersion.isInstance(e)) return (T) e; - } - return fail(clsName, nullVersion); - } catch (ClassNotFoundException e) { - return fail(clsName, nullVersion); - } - } - - private static M fail(String clsName, M failure) { - String[] split = clsName.split("\\."); - String module; - if (split.length < 2) { - BCLog.logger.warn("Tried and failed to get the module name from " + Arrays.toString(split) + " (" + clsName + ")!"); - module = "invalid"; - } else { - module = split[1]; - } - module = StringUtils.capitalize(module); - String bcMod = "BuildCraft|" + module; - if (Loader.isModLoaded(bcMod)) { - BCLog.logger.warn("Failed to load the " + clsName + " dispite the appropriate buildcraft module being installed (" + module + ")"); - } - return failure; - } -} diff --git a/src/api/java/buildcraft/api/IDoubleRegistry.java b/src/api/java/buildcraft/api/IDoubleRegistry.java deleted file mode 100644 index 3c5db9254..000000000 --- a/src/api/java/buildcraft/api/IDoubleRegistry.java +++ /dev/null @@ -1,10 +0,0 @@ -package buildcraft.api; - -import java.util.Map.Entry; -import java.util.Set; - -public interface IDoubleRegistry extends ISimpleRegistry { - void registerDefinition(T definition); - - Set> getDefinitions(); -} diff --git a/src/api/java/buildcraft/api/ISimpleRegistry.java b/src/api/java/buildcraft/api/ISimpleRegistry.java deleted file mode 100644 index 9227214f4..000000000 --- a/src/api/java/buildcraft/api/ISimpleRegistry.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api; - -interface ISimpleRegistry { - /** @param uniqueTag The tag to look up. Can be null. - * @return The unique definition associated with the unique tag, or null if the tag was not mapped */ - T getDefinition(String uniqueTag); - - /** @param definition The definition to look up. Can be null. - * @return The unique to for that definition. Will never be null, but will be an empty string if the definition did - * not exist. */ - String getTag(T definition); -} diff --git a/src/api/java/buildcraft/api/ITripleRegistry.java b/src/api/java/buildcraft/api/ITripleRegistry.java deleted file mode 100644 index ea29b613c..000000000 --- a/src/api/java/buildcraft/api/ITripleRegistry.java +++ /dev/null @@ -1,30 +0,0 @@ -package buildcraft.api; - -import java.util.Set; - -import org.apache.commons.lang3.tuple.Triple; - -import net.minecraft.item.Item; - -public interface ITripleRegistry extends ISimpleRegistry { - /** @return An unmodifiable set containing all the current mappings of the registry */ - Set> getDefinitions(); - - // Specifics - - /** @param definition The pipe definition to look up. Can be null. - * @return The item the has been mapped to the definition, or null if the definition was not mapped */ - Item getItem(T definition); - - /** @param item The item to look up the definition of. Can be null. - * @return The definition associated with that item, or null if the item was not mapped. */ - T getDefinition(Item item); - - /** @param item The item to look up the tag of. Can be null. - * @return The unique tag associated with that item, or null if the item was not mapped. */ - String getUniqueTag(Item item); - - /** @param tag The tag to look up the item with. - * @return The item associated with that tag, or null if the tag was not mapped. */ - Item getItem(String tag); -} diff --git a/src/api/java/buildcraft/api/LICENSE b/src/api/java/buildcraft/api/LICENSE deleted file mode 100644 index a445a6fbe..000000000 --- a/src/api/java/buildcraft/api/LICENSE +++ /dev/null @@ -1,87 +0,0 @@ -Minecraft Mod Public License -============================ - -Version 1.0.1 - -0. Definitions --------------- - -Minecraft: Denotes a copy of the Minecraft game licensed by Mojang AB - -User: Anybody that interacts with the software in one of the following ways: - - play - - decompile - - recompile or compile - - modify - - distribute - -Mod: The mod code designated by the present license, in source form, binary -form, as obtained standalone, as part of a wider distribution or resulting from -the compilation of the original or modified sources. - -Dependency: Code required for the mod to work properly. This includes -dependencies required to compile the code as well as any file or modification -that is explicitely or implicitely required for the mod to be working. - -1. Scope --------- - -The present license is granted to any user of the mod. As a prerequisite, -a user must own a legally acquired copy of Minecraft - -2. Liability ------------- - -This mod is provided 'as is' with no warranties, implied or otherwise. The owner -of this mod takes no responsibility for any damages incurred from the use of -this mod. This mod alters fundamental parts of the Minecraft game, parts of -Minecraft may not work with this mod installed. All damages caused from the use -or misuse of this mad fall on the user. - -3. Play rights --------------- - -The user is allowed to install this mod on a client or a server and to play -without restriction. - -4. Modification rights ----------------------- - -The user has the right to decompile the source code, look at either the -decompiled version or the original source code, and to modify it. - -5. Derivation rights --------------------- - -The user has the rights to derive code from this mod, that is to say to -write code that extends or instanciate the mod classes or interfaces, refer to -its objects, or calls its functions. This code is known as "derived" code, and -can be licensed under a license different from this mod. - -6. Distribution of original or modified copy rights ---------------------------------------------------- - -Is subject to distribution rights this entire mod in its various forms. This -include: - - original binary or source forms of this mod files - - modified versions of these binaries or source files, as well as binaries - resulting from source modifications - - patch to its source or binary files - - any copy of a portion of its binary source files - -The user is allowed to redistribute this mod partially, in totality, or -included in a distribution. - -When distributing binary files, the user must provide means to obtain its -entire set of sources or modified sources at no costs. - -All distributions of this mod must remain licensed under the MMPL. - -All dependencies that this mod have on other mods or classes must be licensed -under conditions comparable to this version of MMPL, with the exception of the -Minecraft code and the mod loading framework (e.g. ModLoader, ModLoaderMP or -Bukkit). - -Modified version of binaries and sources, as well as files containing sections -copied from this mod, should be distributed under the terms of the present -license. diff --git a/src/api/java/buildcraft/api/ObjectDefinition.java b/src/api/java/buildcraft/api/ObjectDefinition.java deleted file mode 100644 index 439462dd4..000000000 --- a/src/api/java/buildcraft/api/ObjectDefinition.java +++ /dev/null @@ -1,32 +0,0 @@ -package buildcraft.api; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; - -/* Note that neither this class (Or any of its subtypes) overrides equals or hash code, despite it being used as a key - * in a hash table. This is to speed up comparisons as no two ObjectDefinitions instances should be created with the - * same values. */ -public class ObjectDefinition { - /** A globally unique tag for the pipe */ - public final String globalUniqueTag; - /** A mod unique tag for the pipe. WARNING: this should only be used to register other mod-unique things, such as - * the pipe or gate item. For general use, use {@link #globalUniqueTag} */ - public final String modUniqueTag; - - protected static String getCurrentMod() { - ModContainer container = Loader.instance().activeModContainer(); - if (container == null) { - throw new IllegalStateException("Pipes MUST be registered inside a mod"); - } - return container.getModId(); - } - - private ObjectDefinition(String mod, String modUniqueTag) { - this.globalUniqueTag = mod + ":" + modUniqueTag; - this.modUniqueTag = modUniqueTag; - } - - public ObjectDefinition(String tag) { - this(getCurrentMod(), tag); - } -} diff --git a/src/api/java/buildcraft/api/blocks/IColorRemovable.java b/src/api/java/buildcraft/api/blocks/IColorRemovable.java deleted file mode 100644 index 709b4bc61..000000000 --- a/src/api/java/buildcraft/api/blocks/IColorRemovable.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.blocks; - -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -public interface IColorRemovable { - boolean removeColorFromBlock(World world, BlockPos pos, EnumFacing facing); -} diff --git a/src/api/java/buildcraft/api/blocks/package-info.java b/src/api/java/buildcraft/api/blocks/package-info.java deleted file mode 100644 index c3bc6eac1..000000000 --- a/src/api/java/buildcraft/api/blocks/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|blocks") -package buildcraft.api.blocks; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/blueprints/BlueprintDeployer.java b/src/api/java/buildcraft/api/blueprints/BlueprintDeployer.java deleted file mode 100644 index e0d421681..000000000 --- a/src/api/java/buildcraft/api/blueprints/BlueprintDeployer.java +++ /dev/null @@ -1,30 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.io.File; - -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -/** This class is provided as a utility class for third-party mods that would like to easily deploy structures that are - * written in blueprints. It does not offer control on material that needs to get in, or how the structure is deployed, - * but allows to create contents of a blueprint in one cycle. Note that these functionalities will only work if - * BuildCraft is installed. */ -public abstract class BlueprintDeployer { - - /** The deployed instantiated by BuildCraft. This is set by the BuildCraft builder mod. Mods that want to work with - * BuildCraft not installed should check for this value to be not null. */ - public static BlueprintDeployer instance; - - /** Deploy the contents of the blueprints as if the builder was located at {pos} facing the direction dir. */ - public abstract void deployBlueprint(World world, BlockPos pos, EnumFacing facing, File file); - - /** Deploy the contents of the byte array as if the builder was located at {pos} facing the direction dir. */ - - public abstract void deployBlueprintFromFileStream(World world, BlockPos pos, EnumFacing dir, byte[] data); - -} diff --git a/src/api/java/buildcraft/api/blueprints/BuilderAPI.java b/src/api/java/buildcraft/api/blueprints/BuilderAPI.java deleted file mode 100644 index bbe10af37..000000000 --- a/src/api/java/buildcraft/api/blueprints/BuilderAPI.java +++ /dev/null @@ -1,15 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -public final class BuilderAPI { - public static ISchematicRegistry schematicRegistry; - public static ISchematicHelper schematicHelper; - - public static final int BREAK_ENERGY = 160; - public static final int BUILD_ENERGY = 240; - - private BuilderAPI() {} -} diff --git a/src/api/java/buildcraft/api/blueprints/BuildingPermission.java b/src/api/java/buildcraft/api/blueprints/BuildingPermission.java deleted file mode 100644 index 8661240c4..000000000 --- a/src/api/java/buildcraft/api/blueprints/BuildingPermission.java +++ /dev/null @@ -1,21 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -/** Schematics recorded in the blueprints can restrict situations where a blueprint can be used. A same schematic class - * can have different permissions depending on its contents. It's particularly useful when fixing a schematic, if - * blueprints that saved the previous version should not be built because of a bug (such as dupe bug on inventories). */ -public enum BuildingPermission { - /** No restrictions, blueprints using this schematic are good in all contexts. */ - ALL, - - /** This blueprints containing this schematic can only be used in creative. Maybe the block can't be crafted in - * survival in the first place, or the content of the schematic is known to have dupe bugs. */ - CREATIVE_ONLY, - - /** Blueprints containing this schematic should not be built. This is typically used when a critical problems have - * been fixed, but older versions of the schematic are too badly broken to be retreived. */ - NONE, -} diff --git a/src/api/java/buildcraft/api/blueprints/IBuilderContext.java b/src/api/java/buildcraft/api/blueprints/IBuilderContext.java deleted file mode 100644 index aa93d4bf9..000000000 --- a/src/api/java/buildcraft/api/blueprints/IBuilderContext.java +++ /dev/null @@ -1,22 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - -import buildcraft.api.core.IBox; - -/** This interface provide contextual information when building or initializing blueprint slots. */ -public interface IBuilderContext { - - Vec3 rotatePositionLeft(Vec3 pos); - - IBox surroundingBox(); - - World world(); - - MappingRegistry getMappingRegistry(); -} diff --git a/src/api/java/buildcraft/api/blueprints/ISchematicHelper.java b/src/api/java/buildcraft/api/blueprints/ISchematicHelper.java deleted file mode 100644 index 7327f2e20..000000000 --- a/src/api/java/buildcraft/api/blueprints/ISchematicHelper.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.blueprints; - -import net.minecraft.item.ItemStack; - -public interface ISchematicHelper { - boolean isEqualItem(ItemStack a, ItemStack b); -} diff --git a/src/api/java/buildcraft/api/blueprints/ISchematicRegistry.java b/src/api/java/buildcraft/api/blueprints/ISchematicRegistry.java deleted file mode 100644 index 503c315d5..000000000 --- a/src/api/java/buildcraft/api/blueprints/ISchematicRegistry.java +++ /dev/null @@ -1,19 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.Entity; - -public interface ISchematicRegistry { - void registerSchematicBlock(Block block, Class clazz, Object... params); - - void registerSchematicBlock(IBlockState state, Class clazz, Object... params); - - void registerSchematicEntity(Class entityClass, Class schematicClass, Object... params); - - boolean isSupported(IBlockState state); -} diff --git a/src/api/java/buildcraft/api/blueprints/ITileBuilder.java b/src/api/java/buildcraft/api/blueprints/ITileBuilder.java deleted file mode 100644 index 2c06f64c3..000000000 --- a/src/api/java/buildcraft/api/blueprints/ITileBuilder.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import net.minecraft.inventory.IInventory; - -public interface ITileBuilder extends IInventory { - - boolean isBuildingMaterialSlot(int i); - -} diff --git a/src/api/java/buildcraft/api/blueprints/MappingNotFoundException.java b/src/api/java/buildcraft/api/blueprints/MappingNotFoundException.java deleted file mode 100644 index f84cee627..000000000 --- a/src/api/java/buildcraft/api/blueprints/MappingNotFoundException.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -public class MappingNotFoundException extends Exception { - private static final long serialVersionUID = 1L; - - public MappingNotFoundException(String msg) { - super(msg); - } -} diff --git a/src/api/java/buildcraft/api/blueprints/MappingRegistry.java b/src/api/java/buildcraft/api/blueprints/MappingRegistry.java deleted file mode 100644 index dbe66e320..000000000 --- a/src/api/java/buildcraft/api/blueprints/MappingRegistry.java +++ /dev/null @@ -1,424 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map.Entry; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ListMultimap; - -import org.apache.logging.log4j.Level; - -import net.minecraft.block.Block; -import net.minecraft.crash.CrashReportCategory; -import net.minecraft.entity.Entity; -import net.minecraft.item.Item; -import net.minecraft.nbt.NBTTagByte; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagShort; -import net.minecraft.util.ResourceLocation; - -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fml.common.FMLModContainer; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; -import net.minecraftforge.fml.common.registry.GameRegistry; - -import buildcraft.api.core.BCLog; - -public class MappingRegistry { - - public HashMap blockToId = new HashMap(); - public ArrayList idToBlock = new ArrayList(); - - public HashMap itemToId = new HashMap(); - public ArrayList idToItem = new ArrayList(); - - public HashMap, Integer> entityToId = new HashMap, Integer>(); - public ArrayList> idToEntity = new ArrayList>(); - - private void registerItem(Item item) { - if (item == null) throw new IllegalArgumentException("Cannot register a null item!"); - if (!itemToId.containsKey(item)) { - idToItem.add(item); - itemToId.put(item, idToItem.size() - 1); - } - } - - private void registerBlock(Block block) { - if (block == null) throw new IllegalArgumentException("Cannot register a null block!"); - if (!blockToId.containsKey(block)) { - idToBlock.add(block); - blockToId.put(block, idToBlock.size() - 1); - } - } - - private void registerEntity(Class entityClass) { - if (entityClass == null) throw new IllegalArgumentException("Cannot register a null entityClass!"); - if (!entityToId.containsKey(entityClass)) { - idToEntity.add(entityClass); - entityToId.put(entityClass, idToEntity.size() - 1); - } - } - - public Item getItemForId(int id) throws MappingNotFoundException { - if (id >= idToItem.size()) { - throw new MappingNotFoundException("no item mapping at position " + id); - } - - Item result = idToItem.get(id); - - if (result == null) { - throw new MappingNotFoundException("no item mapping at position " + id); - } else { - return result; - } - } - - public int getIdForItem(Item item) { - if (item == null) throw new NullPointerException("item"); - if (!itemToId.containsKey(item)) { - registerItem(item); - } - - return itemToId.get(item); - } - - public int itemIdToRegistry(int id) { - Item item = Item.getItemById(id); - - return getIdForItem(item); - } - - public ResourceLocation itemIdToWorld(int id) throws MappingNotFoundException { - Item item = getItemForId(id); - - return Item.itemRegistry.getNameForObject(item); - } - - public Block getBlockForId(int id) throws MappingNotFoundException { - if (id >= idToBlock.size()) { - throw new MappingNotFoundException("no block mapping at position " + id); - } - - Block result = idToBlock.get(id); - - if (result == null) { - throw new MappingNotFoundException("no block mapping at position " + id); - } else { - return result; - } - } - - public int getIdForBlock(Block block) { - if (!blockToId.containsKey(block)) { - registerBlock(block); - } - - return blockToId.get(block); - } - - public int blockIdToRegistry(int id) { - Block block = Block.getBlockById(id); - - return getIdForBlock(block); - } - - public ResourceLocation blockIdToWorld(int id) throws MappingNotFoundException { - Block block = getBlockForId(id); - - return Block.blockRegistry.getNameForObject(block); - } - - public Class getEntityForId(int id) throws MappingNotFoundException { - if (id >= idToEntity.size()) { - throw new MappingNotFoundException("no entity mapping at position " + id); - } - - Class result = idToEntity.get(id); - - if (result == null) { - throw new MappingNotFoundException("no entity mapping at position " + id); - } else { - return result; - } - } - - public int getIdForEntity(Class entity) { - if (!entityToId.containsKey(entity)) { - registerEntity(entity); - } - - return entityToId.get(entity); - } - - /** Relocates a stack nbt from the registry referential to the world referential. */ - public void stackToWorld(NBTTagCompound nbt) throws MappingNotFoundException { - // 1.7.10 back-compat - if (nbt.hasKey("id", Constants.NBT.TAG_SHORT)) { - Item item = getItemForId(nbt.getShort("id")); - nbt.setString("id", (Item.itemRegistry.getNameForObject(item).toString())); - } - } - - // versions before 1.8 saved stacks with an Item ID as a short - private boolean isOldStackLayout(NBTTagCompound nbt) { - return nbt.hasKey("id") && nbt.hasKey("Count") && nbt.hasKey("Damage") && nbt.getTag("id") instanceof NBTTagShort && nbt.getTag( - "Count") instanceof NBTTagByte && nbt.getTag("Damage") instanceof NBTTagShort; - } - - // 1.7.10 Back compat - public void scanAndTranslateStacksToWorld(NBTTagCompound nbt) throws MappingNotFoundException { - // First, check if this nbt is itself a stack - - if (isOldStackLayout(nbt)) { - stackToWorld(nbt); - } - - // Then, look at the nbt compound contained in this nbt (even if it's a - // stack) and checks for stacks in it. - for (String key : (Collection) nbt.getKeySet()) { - if (nbt.getTag(key) instanceof NBTTagCompound) { - try { - scanAndTranslateStacksToWorld(nbt.getCompoundTag(key)); - } catch (MappingNotFoundException e) { - nbt.removeTag(key); - } - } - - if (nbt.getTag(key) instanceof NBTTagList) { - NBTTagList list = (NBTTagList) nbt.getTag(key); - - if (list.getTagType() == Constants.NBT.TAG_COMPOUND) { - for (int i = list.tagCount() - 1; i >= 0; --i) { - try { - scanAndTranslateStacksToWorld(list.getCompoundTagAt(i)); - } catch (MappingNotFoundException e) { - list.removeTag(i); - } - } - } - } - } - } - - public void write(NBTTagCompound nbt) { - NBTTagList blocksMapping = new NBTTagList(); - - for (Block b : idToBlock) { - NBTTagCompound sub = new NBTTagCompound(); - if (b != null) { - Object obj = Block.blockRegistry.getNameForObject(b); - if (obj == null) { - BCLog.logger.error("Block " + b.getUnlocalizedName() + " (" + b.getClass().getName() - + ") does not have a registry name! This is a bug!"); - } else { - String name = obj.toString(); - if (name == null || name.length() == 0) { - BCLog.logger.error("Block " + b.getUnlocalizedName() + " (" + b.getClass().getName() - + ") has an empty registry name! This is a bug!"); - } else { - sub.setString("name", name); - } - } - } else { - throw new IllegalArgumentException("Found a null block!"); - } - blocksMapping.appendTag(sub); - } - - nbt.setTag("blocksMapping", blocksMapping); - - NBTTagList itemsMapping = new NBTTagList(); - - for (Item i : idToItem) { - NBTTagCompound sub = new NBTTagCompound(); - if (i != null) { - ResourceLocation obj = Item.itemRegistry.getNameForObject(i); - if (obj == null) { - BCLog.logger.error("Item " + i.getUnlocalizedName() + " (" + i.getClass().getName() - + ") does not have a registry name! This is a bug!"); - } else { - String name = obj.toString(); - if (name == null || name.length() == 0) { - BCLog.logger.error("Item " + i.getUnlocalizedName() + " (" + i.getClass().getName() - + ") has an empty registry name! This is a bug!"); - } else { - sub.setString("name", name); - } - } - } else { - throw new IllegalArgumentException("Found a null item!"); - } - itemsMapping.appendTag(sub); - } - - nbt.setTag("itemsMapping", itemsMapping); - - NBTTagList entitiesMapping = new NBTTagList(); - - for (Class e : idToEntity) { - NBTTagCompound sub = new NBTTagCompound(); - sub.setString("name", e.getCanonicalName()); - entitiesMapping.appendTag(sub); - } - - nbt.setTag("entitiesMapping", entitiesMapping); - - // System.out.println("[W] idToItem size : " + idToItem.size()); - // for (Item i : idToItem) { - // System.out.println("- " + (i != null ? i.toString() : "null")); - // } - } - - private Object getMissingMappingFromFML(boolean isBlock, String name, int i) { - ResourceLocation location = new ResourceLocation(name); - String modName = name.split(":")[0]; - if (Loader.isModLoaded(modName)) { - try { - FMLMissingMappingsEvent.MissingMapping mapping = new FMLMissingMappingsEvent.MissingMapping(isBlock ? GameRegistry.Type.BLOCK - : GameRegistry.Type.ITEM, location, i); - ListMultimap missingMapping = ArrayListMultimap.create(); - missingMapping.put(modName, mapping); - FMLMissingMappingsEvent event = new FMLMissingMappingsEvent(missingMapping); - for (ModContainer container : Loader.instance().getModList()) { - if (container instanceof FMLModContainer) { - event.applyModContainer(container); - ((FMLModContainer) container).handleModStateEvent(event); - if (mapping.getAction() != FMLMissingMappingsEvent.Action.DEFAULT) { - break; - } - } - } - if (mapping.getAction() == FMLMissingMappingsEvent.Action.REMAP) { - return mapping.getTarget(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - return null; - } - - public void read(NBTTagCompound nbt) { - NBTTagList blocksMapping = nbt.getTagList("blocksMapping", Constants.NBT.TAG_COMPOUND); - - for (int i = 0; i < blocksMapping.tagCount(); ++i) { - NBTTagCompound sub = blocksMapping.getCompoundTagAt(i); - if (!sub.hasKey("name")) { - // Keeping the order correct - idToBlock.add(null); - BCLog.logger.log(Level.WARN, "Can't load a block - corrupt blueprint!"); - continue; - } - String name = sub.getString("name"); - ResourceLocation location = new ResourceLocation(name); - Block b = null; - - if (!Block.blockRegistry.containsKey(location) && name.contains(":")) { - b = (Block) getMissingMappingFromFML(true, name, i); - if (b != null) { - BCLog.logger.info("Remapped " + name + " to " + Block.blockRegistry.getNameForObject(b)); - } - } - - if (b == null && Block.blockRegistry.containsKey(location)) { - b = (Block) Block.blockRegistry.getObject(location); - } - - if (b != null) { - registerBlock(b); - } else { - // Keeping the order correct - idToBlock.add(null); - BCLog.logger.log(Level.WARN, "Can't load block " + name); - } - } - - NBTTagList itemsMapping = nbt.getTagList("itemsMapping", Constants.NBT.TAG_COMPOUND); - - for (int i = 0; i < itemsMapping.tagCount(); ++i) { - NBTTagCompound sub = itemsMapping.getCompoundTagAt(i); - if (!sub.hasKey("name")) { - // Keeping the order correct - idToItem.add(null); - BCLog.logger.log(Level.WARN, "Can't load an item - corrupt blueprint!"); - continue; - } - - String name = sub.getString("name"); - ResourceLocation location = new ResourceLocation(name); - Item item = null; - - if (!Item.itemRegistry.containsKey(location) && name.contains(":")) { - item = (Item) getMissingMappingFromFML(false, name, i); - if (item != null) { - BCLog.logger.info("Remapped " + name + " to " + Item.itemRegistry.getNameForObject(item)); - } - } - - if (item == null && Item.itemRegistry.containsKey(location)) { - item = (Item) Item.itemRegistry.getObject(location); - } - - if (item != null) { - registerItem(item); - } else { - // Keeping the order correct - idToItem.add(null); - BCLog.logger.log(Level.WARN, "Can't load item " + name); - } - } - - NBTTagList entitiesMapping = nbt.getTagList("entitiesMapping", Constants.NBT.TAG_COMPOUND); - - for (int i = 0; i < entitiesMapping.tagCount(); ++i) { - NBTTagCompound sub = entitiesMapping.getCompoundTagAt(i); - String name = sub.getString("name"); - Class e = null; - - try { - e = (Class) Class.forName(name); - } catch (ClassNotFoundException e1) { - e1.printStackTrace(); - } - - if (e != null) { - registerEntity(e); - } else { - // Keeping the order correct - idToEntity.add(null); - BCLog.logger.log(Level.WARN, "Can't load entity " + name); - } - } - - // System.out.println("[R] idToItem size : " + idToItem.size()); - // for (Item i : idToItem) { - // System.out.println("- " + (i != null ? i.toString() : "null")); - // } - } - - public void addToCrashReport(CrashReportCategory cat) { - cat.addCrashSection("Item Map Count", itemToId.size()); - for (Entry e : itemToId.entrySet()) { - cat.addCrashSection(" - ID " + e.getValue(), Item.itemRegistry.getNameForObject(e.getKey())); - } - - cat.addCrashSection("Block Map Count", blockToId.size()); - for (Entry e : blockToId.entrySet()) { - cat.addCrashSection(" - ID " + e.getValue(), Block.blockRegistry.getNameForObject(e.getKey())); - } - - cat.addCrashSection("Entity Map Count", entityToId.size()); - for (Entry, Integer> e : entityToId.entrySet()) { - cat.addCrashSection(" - ID " + e.getValue(), e.getKey()); - } - } -} diff --git a/src/api/java/buildcraft/api/blueprints/Schematic.java b/src/api/java/buildcraft/api/blueprints/Schematic.java deleted file mode 100644 index a43358801..000000000 --- a/src/api/java/buildcraft/api/blueprints/Schematic.java +++ /dev/null @@ -1,195 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; - -import buildcraft.api.core.IInvSlot; - -/** A schematic is a piece of a blueprint. It allows to stock blocks or entities to blueprints, and can have a state - * that moves from a blueprint referential to a world referential. Although default schematic behavior will be OK for a - * lot of objects, specific blocks and entities may be associated with a dedicated schematic class, which will be - * instantiated automatically. - * - * Schematic perform "id translation" in case the block ids between a blueprint and the world installation are - * different. Mapping is done through the builder context. - * - * Detailed documentation on the schematic behavior can be found on - * http://www.mod-buildcraft.com/wiki/doku.php?id=builder_support - * - * Example of schematics for minecraft blocks are available in the package buildcraft.core.schematics. */ -public abstract class Schematic { - /** Blocks are build in various stages, in order to make sure that a block can indeed be placed, and that it's - * unlikely to disturb other blocks. */ - public enum BuildingStage { - /** Standalone blocks do not change once placed. */ - STANDALONE, - - /** Expanding blocks will grow and may disturb other block locations, like liquids. */ - EXPANDING - } - - /** This is called to verify whether the required item is equal to the supplied item. - * - * Primarily rely on this for checking metadata/NBT - the item ID itself might have been filtered out by previously - * running code. */ - public boolean isItemMatchingRequirement(ItemStack suppliedStack, ItemStack requiredStack) { - return BuilderAPI.schematicHelper.isEqualItem(suppliedStack, requiredStack); - } - - /** This is called each time an item matches a requirement. By default, it will increase damage of items that can be - * damaged by the amount of the requirement, and remove the intended amount of items that can't be damaged. - * - * Client may override this behavior. Note that this subprogram may be called twice with the same parameters, once - * with a copy of requirements and stack to check if the entire requirements can be fulfilled, and once with the - * real inventory. Implementer is responsible for updating req (with the remaining requirements if any) and slot - * (after usage). - * - * returns what was used (similar to req, but created from slot, so that any NBT based differences are drawn from - * the correct source) */ - public ItemStack useItem(IBuilderContext context, ItemStack req, IInvSlot slot) { - ItemStack stack = slot.getStackInSlot(); - ItemStack result = stack.copy(); - - if (stack.isItemStackDamageable()) { - if (req.getItemDamage() + stack.getItemDamage() <= stack.getMaxDamage()) { - stack.setItemDamage(req.getItemDamage() + stack.getItemDamage()); - result.setItemDamage(req.getItemDamage()); - req.stackSize = 0; - } - - if (stack.getItemDamage() >= stack.getMaxDamage()) { - slot.decreaseStackInSlot(1); - } - } else { - if (stack.stackSize >= req.stackSize) { - result.stackSize = req.stackSize; - stack.stackSize -= req.stackSize; - req.stackSize = 0; - } else { - req.stackSize -= stack.stackSize; - stack.stackSize = 0; - } - } - - if (stack.stackSize == 0) { - stack.stackSize = 1; - if (stack.getItem().hasContainerItem(stack)) { - ItemStack newStack = stack.getItem().getContainerItem(stack); - slot.setStackInSlot(newStack); - } else { - slot.setStackInSlot(null); - } - } - - return result; - } - - /** Perform a 90 degree rotation to the slot. */ - public void rotateLeft(IBuilderContext context) { - - } - - /** Applies translations to all positions in the schematic to center in the blueprint referential */ - public void translateToBlueprint(Vec3 transform) { - - } - - /** Apply translations to all positions in the schematic to center in the builder referential */ - public void translateToWorld(Vec3 transform) {} - - /** Translates blocks and item ids to the blueprint referential */ - public void idsToBlueprint(MappingRegistry registry) {} - - /** Translates blocks and item ids to the world referential */ - public void idsToWorld(MappingRegistry registry) {} - - /** Initializes a schematic for blueprint according to an objet placed on {x, y, z} on the world. For blocks, block - * and meta fields will be initialized automatically. */ - public void initializeFromObjectAt(IBuilderContext context, BlockPos pos) {} - - /** Places the block in the world, at the location specified in the slot, using the stack in parameters */ - public void placeInWorld(IBuilderContext context, BlockPos pos, List stacks) {} - - /** Write specific requirements coming from the world to the blueprint. */ - public void storeRequirements(IBuilderContext context, BlockPos pos) {} - - /** Returns the requirements needed to build this block. When the requirements are met, they will be removed all at - * once from the builder, before calling writeToWorld. */ - public void getRequirementsForPlacement(IBuilderContext context, List requirements) {} - - /** Returns the amount of energy required to build this slot, depends on the stacks selected for the build. */ - public int getEnergyRequirement(List stacksUsed) { - int result = 0; - - if (stacksUsed != null) { - for (ItemStack s : stacksUsed) { - result += s.stackSize * BuilderAPI.BUILD_ENERGY; - } - } - - return result; - } - - /** Returns the flying stacks to display in the builder animation. */ - public List getStacksToDisplay(List stackConsumed) { - return stackConsumed; - } - - /** Return the stage where this schematic has to be built. */ - public BuildingStage getBuildStage() { - return BuildingStage.STANDALONE; - } - - /** Return true if the block on the world correspond to the block stored in the blueprint at the location given by - * the slot. By default, this subprogram is permissive and doesn't take into account metadata. - * - * Post processing will be called on these blocks. */ - public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { - return true; - } - - /** Return true if the block should not be placed to the world. Requirements will not be asked on such a block, and - * building will not be called. - * - * Post processing will be called on these blocks. */ - public boolean doNotBuild() { - return false; - } - - /** Return true if the schematic should not be used at all. This is computed straight after readFromNBT can be used - * to deactivate schematics in which an inconsistency is detected. It will be considered as a block of air instead. - * - * Post processing will *not* be called on these blocks. */ - public boolean doNotUse() { - return false; - } - - /** Return the maximium building permission for blueprint containing this schematic. */ - public BuildingPermission getBuildingPermission() { - return BuildingPermission.ALL; - } - - /** Called on a block when the blueprint has finished to place all the blocks. This may be useful to adjust variable - * depending on surrounding blocks that may not be there already at initial building. */ - public void postProcessing(IBuilderContext context, BlockPos pos) {} - - /** Saves this schematic to the blueprint NBT. */ - public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) {} - - /** Loads this schematic from the blueprint NBT. */ - public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) {} - - /** Returns the number of cycles to wait after building this schematic. Tiles and entities typically require more - * wait, around 5 cycles. */ - public int buildTime() { - return 1; - } -} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicBlock.java b/src/api/java/buildcraft/api/blueprints/SchematicBlock.java deleted file mode 100644 index 68385343a..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicBlock.java +++ /dev/null @@ -1,213 +0,0 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.*; - -import com.google.gson.GsonBuilder; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockFalling; -import net.minecraft.block.BlockLiquid; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumFacing.Axis; - -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fluids.BlockFluidBase; - -import buildcraft.api.core.BCLog; - -public class SchematicBlock extends SchematicBlockBase { - public IBlockState state = null; - public BuildingPermission defaultPermission = BuildingPermission.ALL; - - /** This field contains requirements for a given block when stored in the blueprint. Modders can either rely on this - * list or compute their own int Schematic. */ - public ItemStack[] storedRequirements = new ItemStack[0]; - - private boolean doNotUse = false; - - @Override - public void getRequirementsForPlacement(IBuilderContext context, List requirements) { - if (state != null) { - if (storedRequirements.length != 0) { - Collections.addAll(requirements, storedRequirements); - } else { - requirements.add(getItemStack(state)); - } - } - } - - @Override - public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { - IBlockState placed = context.world().getBlockState(pos); - if (state == placed) return true; - if (state.getBlock() != placed.getBlock()) return false; - // This fixes bugs with blocks like stairs that return extra properties that were not visible from the meta. - if (state.getBlock().getMetaFromState(state) == placed.getBlock().getMetaFromState(placed)) return true; - return false; - } - - @Override - public void placeInWorld(IBuilderContext context, BlockPos pos, List stacks) { - super.placeInWorld(context, pos, stacks); - - this.setBlockInWorld(context, pos); - } - - @Override - public void storeRequirements(IBuilderContext context, BlockPos pos) { - super.storeRequirements(context, pos); - - if (state != null) { - List req = state.getBlock().getDrops(context.world(), pos, state, 0); - - if (req != null) { - storedRequirements = new ItemStack[req.size()]; - req.toArray(storedRequirements); - } - } - } - - @Override - public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.writeSchematicToNBT(nbt, registry); - - writeBlockToNBT(nbt, registry); - writeRequirementsToNBT(nbt, registry); - } - - @Override - public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.readSchematicFromNBT(nbt, registry); - - readBlockFromNBT(nbt, registry); - if (!doNotUse()) { - readRequirementsFromNBT(nbt, registry); - } - } - - /** Get a list of relative block coordinates which have to be built before this block can be placed. */ - public Set getPrerequisiteBlocks(IBuilderContext context) { - Set indexes = new HashSet(); - if (state.getBlock() instanceof BlockFalling) { - indexes.add(new BlockPos(0, -1, 0)); - } - return indexes; - } - - @Override - public BuildingStage getBuildStage() { - if (state.getBlock() instanceof BlockFluidBase || state.getBlock() instanceof BlockLiquid) { - return BuildingStage.EXPANDING; - } else { - return BuildingStage.STANDALONE; - } - } - - @Override - public BuildingPermission getBuildingPermission() { - return defaultPermission; - } - - // Utility functions - protected void setBlockInWorld(IBuilderContext context, BlockPos pos) { - context.world().setBlockState(pos, state, 3); - } - - @Override - public boolean doNotUse() { - return doNotUse; - } - - protected void readBlockFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - try { - Block block = registry.getBlockForId(nbt.getInteger("blockId")); - state = block.getStateFromMeta(nbt.getInteger("blockMeta")); - } catch (MappingNotFoundException e) { - BCLog.logger.info(e); - doNotUse = true; - } - } - - protected void readRequirementsFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - if (nbt.hasKey("rq")) { - NBTTagList rq = nbt.getTagList("rq", Constants.NBT.TAG_COMPOUND); - - ArrayList rqs = new ArrayList(); - for (int i = 0; i < rq.tagCount(); ++i) { - try { - NBTTagCompound sub = rq.getCompoundTagAt(i); - registry.stackToWorld(sub); - rqs.add(ItemStack.loadItemStackFromNBT(sub)); - } catch (MappingNotFoundException e) { - defaultPermission = BuildingPermission.CREATIVE_ONLY; - } catch (Throwable t) { - t.printStackTrace(); - defaultPermission = BuildingPermission.CREATIVE_ONLY; - } - } - - storedRequirements = rqs.toArray(new ItemStack[rqs.size()]); - } else { - storedRequirements = new ItemStack[0]; - } - } - - protected void writeBlockToNBT(NBTTagCompound nbt, MappingRegistry registry) { - nbt.setInteger("blockId", registry.getIdForBlock(state.getBlock())); - nbt.setInteger("blockMeta", state.getBlock().getMetaFromState(state)); - } - - protected void writeRequirementsToNBT(NBTTagCompound nbt, MappingRegistry registry) { - if (storedRequirements.length > 0) { - NBTTagList rq = new NBTTagList(); - - for (ItemStack stack : storedRequirements) { - if (stack == null || stack.getItem() == null) throw new IllegalStateException("Found a null requirement! " + getClass()); - NBTTagCompound sub = new NBTTagCompound(); - stack.writeToNBT(sub); - rq.appendTag(sub); - } - - nbt.setTag("rq", rq); - } - } - - protected ItemStack getItemStack(IBlockState state, int quantity) { - return new ItemStack(state.getBlock(), quantity, state.getBlock().damageDropped(state)); - } - - protected ItemStack getItemStack(IBlockState state) { - return getItemStack(state, 1); - } - - // Pretty much all blocks (that rotate) rotate this way now - @Override - public void rotateLeft(IBuilderContext context) { - IProperty facingProp = getFacingProp(); - if (facingProp != null) { - EnumFacing face = state.getValue(facingProp); - if (face.getAxis() == Axis.Y) return; - state = state.withProperty(facingProp, face.rotateY()); - } - } - - protected IProperty getFacingProp() { - Collection props = state.getPropertyNames(); - for (IProperty prop : props) { - if ("facing".equals(prop.getName()) && state.getValue(prop) instanceof EnumFacing) { - return prop; - } - } - return null; - } -} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicBlockBase.java b/src/api/java/buildcraft/api/blueprints/SchematicBlockBase.java deleted file mode 100644 index 69f18a2eb..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicBlockBase.java +++ /dev/null @@ -1,9 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -public abstract class SchematicBlockBase extends Schematic { - -} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicEntity.java b/src/api/java/buildcraft/api/blueprints/SchematicEntity.java deleted file mode 100644 index 2057bd6d5..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicEntity.java +++ /dev/null @@ -1,194 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagDouble; -import net.minecraft.nbt.NBTTagFloat; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.Vec3; - -import net.minecraftforge.common.util.Constants; - -public class SchematicEntity extends Schematic { - public Class entity; - - /** This tree contains additional data to be stored in the blueprint. By default, it will be initialized from - * Schematic.readFromWord with the standard readNBT function of the corresponding tile (if any) and will be loaded - * from BptBlock.writeToWorld using the standard writeNBT function. */ - public NBTTagCompound entityNBT = new NBTTagCompound(); - - /** This field contains requirements for a given block when stored in the blueprint. Modders can either rely on this - * list or compute their own int Schematic. */ - public ItemStack[] storedRequirements = new ItemStack[0]; - public BuildingPermission defaultPermission = BuildingPermission.ALL; - - @Override - public void getRequirementsForPlacement(IBuilderContext context, List requirements) { - Collections.addAll(requirements, storedRequirements); - } - - public void writeToWorld(IBuilderContext context) { - Entity e = EntityList.createEntityFromNBT(entityNBT, context.world()); - context.world().spawnEntityInWorld(e); - } - - public void readFromWorld(IBuilderContext context, Entity entity) { - entity.writeToNBTOptional(entityNBT); - } - - @Override - public void translateToBlueprint(Vec3 transform) { - NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 pos = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); - pos = pos.add(transform); - entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); - } - - @Override - public void translateToWorld(Vec3 transform) { - NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 pos = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); - pos = pos.add(transform); - - entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); - } - - @Override - public void idsToBlueprint(MappingRegistry registry) {} - - @Override - public void idsToWorld(MappingRegistry registry) { - try { - registry.scanAndTranslateStacksToWorld(entityNBT); - } catch (MappingNotFoundException e) { - entityNBT = new NBTTagCompound(); - } - } - - @Override - public void rotateLeft(IBuilderContext context) { - NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 pos = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); - pos = context.rotatePositionLeft(pos); - entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); - - nbttaglist = entityNBT.getTagList("Rotation", 5); - float yaw = nbttaglist.getFloatAt(0); - yaw += 90; - entityNBT.setTag("Rotation", this.newFloatNBTList(yaw, nbttaglist.getFloatAt(1))); - } - - @Override - public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.writeSchematicToNBT(nbt, registry); - - nbt.setInteger("entityId", registry.getIdForEntity(entity)); - nbt.setTag("entity", entityNBT); - - NBTTagList rq = new NBTTagList(); - - for (ItemStack stack : storedRequirements) { - NBTTagCompound sub = new NBTTagCompound(); - stack.writeToNBT(stack.writeToNBT(sub)); - sub.setInteger("id", registry.getIdForItem(stack.getItem())); - rq.appendTag(sub); - } - - nbt.setTag("rq", rq); - } - - @Override - public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.readSchematicFromNBT(nbt, registry); - - entityNBT = nbt.getCompoundTag("entity"); - - NBTTagList rq = nbt.getTagList("rq", Constants.NBT.TAG_COMPOUND); - - ArrayList rqs = new ArrayList(); - - for (int i = 0; i < rq.tagCount(); ++i) { - try { - NBTTagCompound sub = rq.getCompoundTagAt(i); - - if (sub.getInteger("id") >= 0) { - // Maps the id in the blueprint to the id in the world - sub.setInteger("id", Item.itemRegistry.getIDForObject(registry.getItemForId(sub.getInteger("id")))); - - rqs.add(ItemStack.loadItemStackFromNBT(sub)); - } else { - defaultPermission = BuildingPermission.CREATIVE_ONLY; - } - } catch (Throwable t) { - t.printStackTrace(); - defaultPermission = BuildingPermission.CREATIVE_ONLY; - } - } - - storedRequirements = rqs.toArray(new ItemStack[rqs.size()]); - } - - protected NBTTagList newDoubleNBTList(double... par1ArrayOfDouble) { - NBTTagList nbttaglist = new NBTTagList(); - double[] adouble = par1ArrayOfDouble; - int i = par1ArrayOfDouble.length; - - for (int j = 0; j < i; ++j) { - double d1 = adouble[j]; - nbttaglist.appendTag(new NBTTagDouble(d1)); - } - - return nbttaglist; - } - - protected NBTTagList newFloatNBTList(float... par1ArrayOfFloat) { - NBTTagList nbttaglist = new NBTTagList(); - float[] afloat = par1ArrayOfFloat; - int i = par1ArrayOfFloat.length; - - for (int j = 0; j < i; ++j) { - float f1 = afloat[j]; - nbttaglist.appendTag(new NBTTagFloat(f1)); - } - - return nbttaglist; - } - - public boolean isAlreadyBuilt(IBuilderContext context) { - NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 newPosition = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); - - for (Object o : context.world().loadedEntityList) { - Entity e = (Entity) o; - - Vec3 existingPositon = new Vec3(e.posX, e.posY, e.posZ); - - if (existingPositon.distanceTo(newPosition) <= 0.1) { - return true; - } - } - - return false; - } - - @Override - public int buildTime() { - return 5; - } - - @Override - public BuildingPermission getBuildingPermission() { - return defaultPermission; - } -} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicFactory.java b/src/api/java/buildcraft/api/blueprints/SchematicFactory.java deleted file mode 100644 index 878b15714..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.HashMap; - -import net.minecraft.nbt.NBTTagCompound; - -public abstract class SchematicFactory { - - private static final HashMap> factories = new HashMap>(); - - private static final HashMap, SchematicFactory> schematicToFactory = - new HashMap, SchematicFactory>(); - - protected abstract S loadSchematicFromWorldNBT(NBTTagCompound nbt, MappingRegistry registry) throws MappingNotFoundException; - - public void saveSchematicToWorldNBT(NBTTagCompound nbt, S object, MappingRegistry registry) { - nbt.setString("factoryID", getClass().getCanonicalName()); - } - - public static Schematic createSchematicFromWorldNBT(NBTTagCompound nbt, MappingRegistry registry) throws MappingNotFoundException { - String factoryName = nbt.getString("factoryID"); - - if (factories.containsKey(factoryName)) { - return factories.get(factoryName).loadSchematicFromWorldNBT(nbt, registry); - } else { - return null; - } - } - - public static void registerSchematicFactory(Class clas, SchematicFactory factory) { - schematicToFactory.put(clas, factory); - factories.put(factory.getClass().getCanonicalName(), factory); - } - - public static SchematicFactory getFactory(Class clas) { - Class superClass = clas.getSuperclass(); - - if (schematicToFactory.containsKey(clas)) { - return schematicToFactory.get(clas); - } else if (superClass != null) { - return getFactory(superClass); - } else { - return null; - } - } - -} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicFluid.java b/src/api/java/buildcraft/api/blueprints/SchematicFluid.java deleted file mode 100644 index 798f01728..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicFluid.java +++ /dev/null @@ -1,84 +0,0 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.BlockLiquid; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; - -import net.minecraftforge.fluids.FluidStack; - -public class SchematicFluid extends SchematicBlock { - - private final ItemStack fluidItem; - - public SchematicFluid(FluidStack fluidStack) { - this.fluidItem = new ItemStack(fluidStack.getFluid().getBlock(), 1); - } - - @Override - public void getRequirementsForPlacement(IBuilderContext context, List requirements) { - if (getLevel() == 0) { - requirements.add(fluidItem); - } - } - - @Override - public void storeRequirements(IBuilderContext context, BlockPos pos) { - // cancel requirements reading - } - - @Override - public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { - if (getLevel() == 0) { - return state == context.world().getBlockState(pos) && ((Integer) context.world().getBlockState(pos).getValue(BlockLiquid.LEVEL)) == 0; - } else { - return state == context.world().getBlockState(pos); - } - } - - @Override - public void rotateLeft(IBuilderContext context) { - - } - - @Override - public boolean doNotBuild() { - return getLevel() != 0; - } - - @Override - public void placeInWorld(IBuilderContext context, BlockPos pos, List stacks) { - if (getLevel() == 0) { - context.world().setBlockState(pos, state, 3); - } - } - - @Override - public void postProcessing(IBuilderContext context, BlockPos pos) { - if (getLevel() != 0) { - context.world().setBlockState(pos, state, 3); - } - } - - @Override - public List getStacksToDisplay(List stackConsumed) { - List result = new ArrayList(); - result.add(fluidItem); - return result; - } - - @Override - public int getEnergyRequirement(List stacksUsed) { - return 1 * BuilderAPI.BUILD_ENERGY; - } - - public int getLevel() { - return (Integer) state.getValue(BlockLiquid.LEVEL); - } -} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicMask.java b/src/api/java/buildcraft/api/blueprints/SchematicMask.java deleted file mode 100644 index c2953e286..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicMask.java +++ /dev/null @@ -1,83 +0,0 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.List; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.WorldServer; - -import buildcraft.api.core.BuildCraftAPI; - -public class SchematicMask extends SchematicBlockBase { - /** True of the block should be a solid block (stone, grass or a furnace) and false if it shouldn't (flowers, air or - * vines) */ - public boolean isConcrete = true; - - public SchematicMask() { - - } - - public SchematicMask(boolean isConcrete) { - this.isConcrete = isConcrete; - } - - @Override - public void placeInWorld(IBuilderContext context, BlockPos pos, List stacks) { - if (isConcrete) { - if (stacks.size() == 0 || !BuildCraftAPI.isSoftBlock(context.world(), pos)) { - return; - } else { - ItemStack stack = stacks.get(0); - EntityPlayer player = BuildCraftAPI.proxy.getBuildCraftPlayer((WorldServer) context.world()).get(); - - // force the block to be air block, in case it's just a soft - // block which replacement is not straightforward - context.world().setBlockToAir(pos); - - // Find nearest solid surface to place on - EnumFacing solidFace = null; - for (EnumFacing face : EnumFacing.values()) { - BlockPos offset = pos.offset(face); - if (!BuildCraftAPI.isSoftBlock(context.world(), offset)) { - solidFace = face; - break; - } - } - ItemBlock itemBlock = (ItemBlock) stack.getItem(); - IBlockState state = itemBlock.block.onBlockPlaced(context.world(), pos, solidFace, 0, 0, 0, stack.getMetadata(), player); - itemBlock.placeBlockAt(stack, player, context.world(), pos, solidFace, 0, 0, 0, state); - - } - } else { - context.world().setBlockToAir(pos); - } - } - - @Override - public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { - if (isConcrete) { - return !BuildCraftAPI.getWorldProperty("replaceable").get(context.world(), pos); - } else { - return BuildCraftAPI.getWorldProperty("replaceable").get(context.world(), pos); - } - } - - @Override - public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { - nbt.setBoolean("isConcrete", isConcrete); - } - - @Override - public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - isConcrete = nbt.getBoolean("isConcrete"); - } -} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicTile.java b/src/api/java/buildcraft/api/blueprints/SchematicTile.java deleted file mode 100644 index f70fd19ce..000000000 --- a/src/api/java/buildcraft/api/blueprints/SchematicTile.java +++ /dev/null @@ -1,114 +0,0 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; - -import buildcraft.api.core.JavaTools; - -public class SchematicTile extends SchematicBlock { - - /** This tree contains additional data to be stored in the blueprint. By default, it will be initialized from - * Schematic.readFromWord with the standard readNBT function of the corresponding tile (if any) and will be loaded - * from BptBlock.writeToWorld using the standard writeNBT function. */ - public NBTTagCompound tileNBT = new NBTTagCompound(); - - @Override - public void idsToBlueprint(MappingRegistry registry) {} - - @Override - public void idsToWorld(MappingRegistry registry) { - try { - registry.scanAndTranslateStacksToWorld(tileNBT); - } catch (MappingNotFoundException e) { - tileNBT = new NBTTagCompound(); - } - } - - public void onNBTLoaded() { - - } - - /** Places the block in the world, at the location specified in the slot. */ - @Override - public void placeInWorld(IBuilderContext context, BlockPos pos, List stacks) { - super.placeInWorld(context, pos, stacks); - - if (state.getBlock().hasTileEntity(state)) { - tileNBT.setInteger("x", pos.getX()); - tileNBT.setInteger("y", pos.getY()); - tileNBT.setInteger("z", pos.getZ()); - TileEntity tile = TileEntity.createAndLoadEntity(tileNBT); - tile.setWorldObj(context.world()); - context.world().setTileEntity(pos, tile); - } - } - - @Override - public void initializeFromObjectAt(IBuilderContext context, BlockPos pos) { - super.initializeFromObjectAt(context, pos); - - if (state.getBlock().hasTileEntity(state)) { - TileEntity tile = context.world().getTileEntity(pos); - - if (tile != null) { - tile.writeToNBT(tileNBT); - } - - tileNBT = (NBTTagCompound) tileNBT.copy(); - onNBTLoaded(); - } - } - - @Override - public void storeRequirements(IBuilderContext context, BlockPos pos) { - super.storeRequirements(context, pos); - - if (state.getBlock().hasTileEntity(state)) { - TileEntity tile = context.world().getTileEntity(pos); - - if (tile instanceof IInventory) { - IInventory inv = (IInventory) tile; - - ArrayList rqs = new ArrayList(); - - for (int i = 0; i < inv.getSizeInventory(); ++i) { - if (inv.getStackInSlot(i) != null) { - rqs.add(inv.getStackInSlot(i)); - } - } - - storedRequirements = JavaTools.concat(storedRequirements, rqs.toArray(new ItemStack[rqs.size()])); - } - } - } - - @Override - public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.writeSchematicToNBT(nbt, registry); - - nbt.setTag("blockCpt", tileNBT); - } - - @Override - public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.readSchematicFromNBT(nbt, registry); - - tileNBT = nbt.getCompoundTag("blockCpt"); - onNBTLoaded(); - } - - @Override - public int buildTime() { - return 5; - } -} diff --git a/src/api/java/buildcraft/api/blueprints/package-info.java b/src/api/java/buildcraft/api/blueprints/package-info.java deleted file mode 100644 index 3b3632424..000000000 --- a/src/api/java/buildcraft/api/blueprints/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.5", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|blueprints") -package buildcraft.api.blueprints; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/boards/IRedstoneBoard.java b/src/api/java/buildcraft/api/boards/IRedstoneBoard.java deleted file mode 100644 index 2aa375e92..000000000 --- a/src/api/java/buildcraft/api/boards/IRedstoneBoard.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.boards; - -public interface IRedstoneBoard { - - void updateBoard(T container); - - RedstoneBoardNBT getNBTHandler(); -} diff --git a/src/api/java/buildcraft/api/boards/RedstoneBoardNBT.java b/src/api/java/buildcraft/api/boards/RedstoneBoardNBT.java deleted file mode 100644 index 6a37e73f0..000000000 --- a/src/api/java/buildcraft/api/boards/RedstoneBoardNBT.java +++ /dev/null @@ -1,44 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.boards; - -import java.util.List; -import java.util.Random; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.Constants; - -public abstract class RedstoneBoardNBT { - - private static Random rand = new Random(); - - public abstract String getID(); - - public abstract void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced); - - public abstract String getDisplayName(); - - public abstract IRedstoneBoard create(NBTTagCompound nbt, T object); - - public abstract String getItemModelLocation(); - - public void createBoard(NBTTagCompound nbt) { - nbt.setString("id", getID()); - } - - public int getParameterNumber(NBTTagCompound nbt) { - if (!nbt.hasKey("parameters")) { - return 0; - } else { - return nbt.getTagList("parameters", Constants.NBT.TAG_COMPOUND).tagCount(); - } - } - - public float nextFloat(int difficulty) { - return 1F - (float) Math.pow(rand.nextFloat(), 1F / difficulty); - } -} diff --git a/src/api/java/buildcraft/api/boards/RedstoneBoardRegistry.java b/src/api/java/buildcraft/api/boards/RedstoneBoardRegistry.java deleted file mode 100644 index 5e8d4e288..000000000 --- a/src/api/java/buildcraft/api/boards/RedstoneBoardRegistry.java +++ /dev/null @@ -1,40 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.boards; - -import java.util.Collection; - -import net.minecraft.nbt.NBTTagCompound; - -public abstract class RedstoneBoardRegistry { - - public static RedstoneBoardRegistry instance; - - /** Register a redstone board type. - * - * @param redstoneBoardNBT The RedstoneBoardNBT instance containing the board information. - * @param energyCost RF price of the board, in RF. */ - public abstract void registerBoardType(RedstoneBoardNBT redstoneBoardNBT, int energyCost); - - @Deprecated - /** Register a redstone board type. Deprecated, use registerBoardType now. - * - * @param redstoneBoardNBT The RedstoneBoardNBT instance containing the board information. - * @param probability Since 6.4.x, this is used to calculate the RF price of the board in the Programming Table by - * doing (160000 / probability). */ - public abstract void registerBoardClass(RedstoneBoardNBT redstoneBoardNBT, float probability); - - public abstract void setEmptyRobotBoard(RedstoneBoardRobotNBT redstoneBoardNBT); - - public abstract RedstoneBoardRobotNBT getEmptyRobotBoard(); - - public abstract RedstoneBoardNBT getRedstoneBoard(NBTTagCompound nbt); - - public abstract RedstoneBoardNBT getRedstoneBoard(String id); - - public abstract Collection> getAllBoardNBTs(); - - public abstract int getEnergyCost(RedstoneBoardNBT board); -} diff --git a/src/api/java/buildcraft/api/boards/RedstoneBoardRobot.java b/src/api/java/buildcraft/api/boards/RedstoneBoardRobot.java deleted file mode 100644 index b0ed0638f..000000000 --- a/src/api/java/buildcraft/api/boards/RedstoneBoardRobot.java +++ /dev/null @@ -1,29 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.boards; - -import buildcraft.api.robots.AIRobot; -import buildcraft.api.robots.EntityRobotBase; - -public abstract class RedstoneBoardRobot extends AIRobot implements IRedstoneBoard { - - public RedstoneBoardRobot(EntityRobotBase iRobot) { - super(iRobot); - } - - @Override - public abstract RedstoneBoardRobotNBT getNBTHandler(); - - @Override - public final void updateBoard(EntityRobotBase container) { - - } - - @Override - public boolean canLoadFromNBT() { - return true; - } - -} diff --git a/src/api/java/buildcraft/api/boards/RedstoneBoardRobotNBT.java b/src/api/java/buildcraft/api/boards/RedstoneBoardRobotNBT.java deleted file mode 100644 index 4a4161b19..000000000 --- a/src/api/java/buildcraft/api/boards/RedstoneBoardRobotNBT.java +++ /dev/null @@ -1,23 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.boards; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ResourceLocation; - -import buildcraft.api.robots.EntityRobotBase; - -public abstract class RedstoneBoardRobotNBT extends RedstoneBoardNBT { - - @Override - public RedstoneBoardRobot create(NBTTagCompound nbt, EntityRobotBase robot) { - return create(robot); - } - - public abstract RedstoneBoardRobot create(EntityRobotBase robot); - - public abstract ResourceLocation getRobotTexture(); - -} diff --git a/src/api/java/buildcraft/api/boards/package-info.java b/src/api/java/buildcraft/api/boards/package-info.java deleted file mode 100644 index 6253f5b79..000000000 --- a/src/api/java/buildcraft/api/boards/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|boards") -package buildcraft.api.boards; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/core/BCLog.java b/src/api/java/buildcraft/api/core/BCLog.java deleted file mode 100644 index f74509173..000000000 --- a/src/api/java/buildcraft/api/core/BCLog.java +++ /dev/null @@ -1,43 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public final class BCLog { - public static final Logger logger = LogManager.getLogger("BuildCraft"); - - /** Deactivate constructor */ - private BCLog() {} - - @Deprecated - public static void logErrorAPI(String mod, Throwable error, Class classFile) { - logErrorAPI(error, classFile); - } - - public static void logErrorAPI(Throwable error, Class classFile) { - StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: "); - msg.append(error); - StackTraceElement[] stackTrace = error.getStackTrace(); - if (stackTrace.length > 0) { - msg.append(", ").append(stackTrace[0]); - } - - logger.log(Level.ERROR, msg.toString()); - - if (classFile != null) { - msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain() - .getCodeSource().getLocation()); - logger.log(Level.ERROR, msg.toString()); - } - } - - @Deprecated - public static String getVersion() { - return BuildCraftAPI.getVersion(); - } -} diff --git a/src/api/java/buildcraft/api/core/BuildCraftAPI.java b/src/api/java/buildcraft/api/core/BuildCraftAPI.java deleted file mode 100644 index 6e43e6d8c..000000000 --- a/src/api/java/buildcraft/api/core/BuildCraftAPI.java +++ /dev/null @@ -1,52 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Set; - -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - -import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -public final class BuildCraftAPI { - - public static ICoreProxy proxy; - - public static final Set softBlocks = Sets.newHashSet(); - public static final HashMap worldProperties = Maps.newHashMap(); - - /** Deactivate constructor */ - private BuildCraftAPI() {} - - public static String getVersion() { - try { - Class clazz = Class.forName("buildcraft.core.Version"); - Method method = clazz.getDeclaredMethod("getVersion"); - return String.valueOf(method.invoke(null)); - } catch (Exception e) { - return "UNKNOWN VERSION"; - } - } - - public static IWorldProperty getWorldProperty(String name) { - return worldProperties.get(name); - } - - public static void registerWorldProperty(String name, IWorldProperty property) { - if (worldProperties.containsKey(name)) { - BCLog.logger.warn("The WorldProperty key '" + name + "' is being overidden with " + property.getClass().getSimpleName() + "!"); - } - worldProperties.put(name, property); - } - - public static boolean isSoftBlock(World world, BlockPos pos) { - return worldProperties.get("soft").get(world, pos); - } -} diff --git a/src/api/java/buildcraft/api/core/ConfigAccessor.java b/src/api/java/buildcraft/api/core/ConfigAccessor.java deleted file mode 100644 index a66346ac5..000000000 --- a/src/api/java/buildcraft/api/core/ConfigAccessor.java +++ /dev/null @@ -1,48 +0,0 @@ -package buildcraft.api.core; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraftforge.common.config.Property; - -/** Use this to access the various config options. It is recommended that you use this as opposed to the variables in - * the mod, as users may only install the modules that they want, and not the one you may have refereed to. */ -@Deprecated -public final class ConfigAccessor { - public enum EMod { - CORE, - BUILDERS, - ENERGY, - FACTORY, - ROBITICS, - SILICON, - TRANSPORT - } - - private static Map mods = Maps.newHashMap(); - - private ConfigAccessor() {} - - public static Property getOption(EMod mod, String name) { - if (mods.containsKey(mod)) { - return mods.get(mod).getOption(name); - } else { - return null; - } - } - - public static boolean getBoolean(EMod mod, String name, boolean defaultBoolean) { - Property prop = getOption(mod, name); - if (prop == null) { - return defaultBoolean; - } else { - return prop.getBoolean(defaultBoolean); - } - } - - /** WARNING: INTERNAL USE ONLY! */ - public static void addMod(EMod mod, IBuildCraftMod actual) { - mods.put(mod, actual); - } -} diff --git a/src/api/java/buildcraft/api/core/EnumColor.java b/src/api/java/buildcraft/api/core/EnumColor.java deleted file mode 100644 index 852eea1ba..000000000 --- a/src/api/java/buildcraft/api/core/EnumColor.java +++ /dev/null @@ -1,147 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.util.Locale; -import java.util.Random; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.IStringSerializable; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** Use minecraft's EnumDyeColor in as many places as possible. */ -@Deprecated -public enum EnumColor implements IStringSerializable { - - BLACK, - RED, - GREEN, - BROWN, - BLUE, - PURPLE, - CYAN, - LIGHT_GRAY, - GRAY, - PINK, - LIME, - YELLOW, - LIGHT_BLUE, - MAGENTA, - ORANGE, - WHITE; - - public static final EnumColor[] VALUES = values(); - public static final String[] DYES = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", - "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" }; - public static final String[] NAMES = { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", - "LightBlue", "Magenta", "Orange", "White" }; - public static final int[] DARK_HEX = { 0x2D2D2D, 0xA33835, 0x394C1E, 0x5C3A24, 0x3441A2, 0x843FBF, 0x36809E, 0x888888, 0x444444, 0xE585A0, - 0x3FAA36, 0xCFC231, 0x7F9AD1, 0xFF64FF, 0xFF6A00, 0xFFFFFF }; - public static final int[] LIGHT_HEX = { 0x181414, 0xBE2B27, 0x007F0E, 0x89502D, 0x253193, 0x7e34bf, 0x299799, 0xa0a7a7, 0x7A7A7A, 0xD97199, - 0x39D52E, 0xFFD91C, 0x66AAFF, 0xD943C6, 0xEA7835, 0xe4e4e4 }; - - @SideOnly(Side.CLIENT) - private static ResourceLocation iconSheet; - - @SideOnly(Side.CLIENT) - private static TextureAtlasSprite[] brushSprites; - - public int getDarkHex() { - return DARK_HEX[ordinal()]; - } - - public int getLightHex() { - return LIGHT_HEX[ordinal()]; - } - - public static EnumColor fromId(int id) { - if (id < 0 || id >= VALUES.length) { - return WHITE; - } - return VALUES[id]; - } - - public static EnumColor fromDye(String dyeTag) { - for (int id = 0; id < DYES.length; id++) { - if (DYES[id].equals(dyeTag)) { - return VALUES[id]; - } - } - return null; - } - - public static EnumColor fromName(String name) { - for (int id = 0; id < NAMES.length; id++) { - if (NAMES[id].equals(name)) { - return VALUES[id]; - } - } - return null; - } - - public static EnumColor getRand() { - return VALUES[new Random().nextInt(VALUES.length)]; - } - - public EnumColor getNext() { - EnumColor next = VALUES[(ordinal() + 1) % VALUES.length]; - return next; - } - - public EnumColor getPrevious() { - EnumColor previous = VALUES[(ordinal() + VALUES.length - 1) % VALUES.length]; - return previous; - } - - public EnumColor inverse() { - return EnumColor.VALUES[15 - ordinal()]; - } - - public String getTag() { - return "color." + name().replace("_", ".").toLowerCase(Locale.ENGLISH); - } - - public String getBasicTag() { - return name().replace("_", ".").toLowerCase(Locale.ENGLISH); - } - - @Override - public String getName() { - return NAMES[ordinal()]; - } - - public String getLocalizedName() { - return StatCollector.translateToLocal(getTag()); - } - - public String getDye() { - return DYES[ordinal()]; - } - - @Override - public String toString() { - String s = name().replace("_", " "); - String[] words = s.split(" "); - StringBuilder b = new StringBuilder(); - for (String word : words) { - b.append(word.charAt(0)).append(word.substring(1).toLowerCase(Locale.ENGLISH)).append(" "); - } - return b.toString().trim(); - } - - @SideOnly(Side.CLIENT) - public static void registerSprites(TextureAtlasSprite[] sprites) { - brushSprites = sprites; - } - - @SideOnly(Side.CLIENT) - public TextureAtlasSprite getSprite() { - return brushSprites[ordinal()]; - } -} diff --git a/src/api/java/buildcraft/api/core/EnumPipePart.java b/src/api/java/buildcraft/api/core/EnumPipePart.java deleted file mode 100644 index 2f97777cb..000000000 --- a/src/api/java/buildcraft/api/core/EnumPipePart.java +++ /dev/null @@ -1,120 +0,0 @@ -package buildcraft.api.core; - -import com.google.common.collect.Maps; -import io.netty.buffer.ByteBuf; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTBase.NBTPrimitive; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.IStringSerializable; - -import java.util.Locale; -import java.util.Map; - -public enum EnumPipePart implements IStringSerializable,INetworkLoadable_BC8 { - DOWN(EnumFacing.DOWN), - UP(EnumFacing.UP), - NORTH(EnumFacing.NORTH), - SOUTH(EnumFacing.SOUTH), - WEST(EnumFacing.WEST), - EAST(EnumFacing.EAST), - /** CENTER, UNKNOWN and ALL are all valid uses of this constant. */ - CENTER(null); - - private static final Map facingMap = Maps.newEnumMap(EnumFacing.class); - private static final Map nameMap = Maps.newHashMap(); - private static final int MAX_VALUES = values().length; - - public final EnumFacing face; - - static { - for (EnumPipePart part : values()) { - nameMap.put(part.name(), part); - if (part.face != null) facingMap.put(part.face, part); - } - } - - public static int ordinal(EnumFacing face) { - return face == null ? 6 : face.ordinal(); - } - - public static EnumPipePart fromFacing(EnumFacing face) { - if (face == null) return EnumPipePart.CENTER; - return facingMap.get(face); - } - - public static EnumPipePart[] validFaces() { - return new EnumPipePart[] { DOWN, UP, NORTH, SOUTH, WEST, EAST }; - } - - public static EnumPipePart fromMeta(int meta) { - if (meta < 0 || meta >= MAX_VALUES) return EnumPipePart.CENTER; - return values()[meta]; - } - - private EnumPipePart(EnumFacing face) { - this.face = face; - } - - public int getIndex() { - if (face == null) return 6; - return face.getIndex(); - } - - @Override - public String getName() { - return name().toLowerCase(Locale.ROOT); - } - - public EnumPipePart next() { - switch (this) { - case DOWN: - return EAST; - case EAST: - return NORTH; - case NORTH: - return SOUTH; - case SOUTH: - return UP; - case UP: - return WEST; - case WEST: - return DOWN; - default: - return DOWN; - } - } - - public EnumPipePart opposite() { - if (this == CENTER) return CENTER; - return fromFacing(face.getOpposite()); - } - - public static EnumPipePart readFromNBT(NBTBase base) { - if (base == null) return CENTER; - if (base instanceof NBTTagString) { - NBTTagString nbtString = (NBTTagString) base; - String string = nbtString.getString(); - return nameMap.containsKey(string) ? nameMap.get(string) : CENTER; - } else { - byte ord = ((NBTPrimitive) base).getByte(); - if (ord < 0 || ord > 6) return CENTER; - return values()[ord]; - } - } - - public NBTBase writeToNBT() { - return new NBTTagString(name()); - } - - @Override - public EnumPipePart readFromByteBuf(ByteBuf buf) { - byte ord = buf.readByte(); - return fromMeta(ord); - } - - @Override - public void writeToByteBuf(ByteBuf buf) { - buf.writeByte(ordinal()); - } -} diff --git a/src/api/java/buildcraft/api/core/IAreaProvider.java b/src/api/java/buildcraft/api/core/IAreaProvider.java deleted file mode 100644 index e504694ba..000000000 --- a/src/api/java/buildcraft/api/core/IAreaProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.util.BlockPos; - -/** To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers. */ -public interface IAreaProvider { - BlockPos min(); - - BlockPos max(); - - /** Remove from the world all objects used to define the area. */ - void removeFromWorld(); -} diff --git a/src/api/java/buildcraft/api/core/IBox.java b/src/api/java/buildcraft/api/core/IBox.java deleted file mode 100644 index d7c11f4f4..000000000 --- a/src/api/java/buildcraft/api/core/IBox.java +++ /dev/null @@ -1,19 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.util.BlockPos; - -public interface IBox extends IZone { - IBox expand(int amount); - - IBox contract(int amount); - - BlockPos min(); - - BlockPos max(); - - void createLaserData(); -} diff --git a/src/api/java/buildcraft/api/core/IBuildCraftMod.java b/src/api/java/buildcraft/api/core/IBuildCraftMod.java deleted file mode 100644 index c287088b1..000000000 --- a/src/api/java/buildcraft/api/core/IBuildCraftMod.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.core; - -import net.minecraftforge.common.config.Property; - -public interface IBuildCraftMod { - Property getOption(String name); -} diff --git a/src/api/java/buildcraft/api/core/ICoreProxy.java b/src/api/java/buildcraft/api/core/ICoreProxy.java deleted file mode 100644 index fc10bc092..000000000 --- a/src/api/java/buildcraft/api/core/ICoreProxy.java +++ /dev/null @@ -1,14 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.lang.ref.WeakReference; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.WorldServer; - -public interface ICoreProxy { - WeakReference getBuildCraftPlayer(WorldServer world); -} diff --git a/src/api/java/buildcraft/api/core/IFluidFilter.java b/src/api/java/buildcraft/api/core/IFluidFilter.java deleted file mode 100644 index 0b61d440d..000000000 --- a/src/api/java/buildcraft/api/core/IFluidFilter.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

- * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.core; - -import net.minecraftforge.fluids.Fluid; - -public interface IFluidFilter { - - boolean matches(Fluid fluid); -} diff --git a/src/api/java/buildcraft/api/core/IIconProvider.java b/src/api/java/buildcraft/api/core/IIconProvider.java deleted file mode 100644 index 418c08a00..000000000 --- a/src/api/java/buildcraft/api/core/IIconProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.core; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IIconProvider { - public TextureAtlasSprite getIcon(int iconIndex); - - @SideOnly(Side.CLIENT) - public void registerIcons(TextureMap iconRegister); -} diff --git a/src/api/java/buildcraft/api/core/IInvSlot.java b/src/api/java/buildcraft/api/core/IInvSlot.java deleted file mode 100644 index a047a2f87..000000000 --- a/src/api/java/buildcraft/api/core/IInvSlot.java +++ /dev/null @@ -1,26 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.item.ItemStack; - -public interface IInvSlot { - /** Returns the slot number of the underlying Inventory. - * - * @return the slot number */ - int getIndex(); - - boolean canPutStackInSlot(ItemStack stack); - - boolean canTakeStackFromSlot(ItemStack stack); - - boolean isItemValidForSlot(ItemStack stack); - - ItemStack decreaseStackInSlot(int amount); - - ItemStack getStackInSlot(); - - void setStackInSlot(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/core/INBTLoadable_BC8.java b/src/api/java/buildcraft/api/core/INBTLoadable_BC8.java deleted file mode 100644 index 8005bcf53..000000000 --- a/src/api/java/buildcraft/api/core/INBTLoadable_BC8.java +++ /dev/null @@ -1,14 +0,0 @@ -package buildcraft.api.core; - -import net.minecraft.nbt.NBTBase; - -/** @param The type that will be loaded from and saved too. This essentially allows Immutable objects to be safely - * loaded without helper methods everywhere. However you are allowed to return this if you are a mutable - * object */ -public interface INBTLoadable_BC8 { - /** @return An object that has the properties loaded. WARNIG! This might be the same object as the one this method - * was called on! (You should always replace the object you have stored with whatever this returns) */ - T readFromNBT(NBTBase nbt); - - NBTBase writeToNBT(); -} diff --git a/src/api/java/buildcraft/api/core/INBTStoreable.java b/src/api/java/buildcraft/api/core/INBTStoreable.java deleted file mode 100644 index c34c134ac..000000000 --- a/src/api/java/buildcraft/api/core/INBTStoreable.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api.core; - -import net.minecraft.nbt.NBTTagCompound; - -/** Use {@link INBTLoadable_BC8} instead of this, as this gives you more control over what NBT goes where, and what - * objects are allowed to do. */ -@Deprecated -public interface INBTStoreable { - void readFromNBT(NBTTagCompound tag); - - void writeToNBT(NBTTagCompound tag); -} diff --git a/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java b/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java deleted file mode 100644 index de0f99e95..000000000 --- a/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.core; - -import io.netty.buffer.ByteBuf; - -public interface INetworkLoadable_BC8 { - T readFromByteBuf(ByteBuf buf); - - void writeToByteBuf(ByteBuf buf); -} diff --git a/src/api/java/buildcraft/api/core/IPathProvider.java b/src/api/java/buildcraft/api/core/IPathProvider.java deleted file mode 100644 index d953bca12..000000000 --- a/src/api/java/buildcraft/api/core/IPathProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.core; - -import java.util.List; - -import net.minecraft.util.BlockPos; - -/** To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers. */ -public interface IPathProvider { - List getPath(); - - /** Remove from the world all objects used to define the path. */ - void removeFromWorld(); -} diff --git a/src/api/java/buildcraft/api/core/ISerializable.java b/src/api/java/buildcraft/api/core/ISerializable.java deleted file mode 100644 index 77d56d541..000000000 --- a/src/api/java/buildcraft/api/core/ISerializable.java +++ /dev/null @@ -1,21 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.core; - -import io.netty.buffer.ByteBuf; - -/** Use {@link INetworkLoadable_BC8} instead, as that gives you more control over how you use objects */ -@Deprecated -public interface ISerializable { - /** Serializes the state to the stream - * - * @param data */ - void writeData(ByteBuf data); - - /** Deserializes the state from the stream - * - * @param data */ - void readData(ByteBuf data); -} diff --git a/src/api/java/buildcraft/api/core/IStackFilter.java b/src/api/java/buildcraft/api/core/IStackFilter.java deleted file mode 100644 index ef4f55883..000000000 --- a/src/api/java/buildcraft/api/core/IStackFilter.java +++ /dev/null @@ -1,14 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

- * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.core; - -import net.minecraft.item.ItemStack; - -/** This interface provides a convenient means of dealing with entire classes of items without having to specify each - * item individually. */ -public interface IStackFilter { - - boolean matches(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/core/IWorldProperty.java b/src/api/java/buildcraft/api/core/IWorldProperty.java deleted file mode 100644 index ba440d7d3..000000000 --- a/src/api/java/buildcraft/api/core/IWorldProperty.java +++ /dev/null @@ -1,14 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -public interface IWorldProperty { - boolean get(World world, BlockPos pos); - - void clear(); -} diff --git a/src/api/java/buildcraft/api/core/IZone.java b/src/api/java/buildcraft/api/core/IZone.java deleted file mode 100644 index 5d722ffe6..000000000 --- a/src/api/java/buildcraft/api/core/IZone.java +++ /dev/null @@ -1,26 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.util.Random; - -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; - -public interface IZone { - /** Returns the smallest possible distance that the index would have to be changed by in order for - * {@link #contains(Vec3)} to return true. If the position is already inside then this will return 0 */ - double distanceTo(BlockPos index); - - /** Returns {@link #distanceTo(BlockPos)} but squared. Usually this will be quicker to calculate. */ - double distanceToSquared(BlockPos index); - - /** Returns true if the point is enclosed by this zone, such that none of the coordinates lie outside the range - * specified by this zone. */ - boolean contains(Vec3 point); - - /** Gets a random position that {@link #contains(Vec3)} will return true. */ - BlockPos getRandomBlockPos(Random rand); -} diff --git a/src/api/java/buildcraft/api/core/Identifier.java b/src/api/java/buildcraft/api/core/Identifier.java deleted file mode 100644 index b940884fe..000000000 --- a/src/api/java/buildcraft/api/core/Identifier.java +++ /dev/null @@ -1,234 +0,0 @@ -package buildcraft.api.core; - -import java.util.Map; -import java.util.UUID; - -import com.google.common.base.Supplier; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** Identifies an in world tile entity or movable entity. Feel free to extend this class if your tile entity contains - * multiple identifiable {@link IPowerConnection}. Just make sure to register it with - * {@link #registerType(String, Supplier)} to make loading work. - *

- * Created on 1 Jan 2016 by AlexIIL */ -public abstract class Identifier { - private static Map> registeredIdentifiers; - - static { - registeredIdentifiers.put("mincraft:tile", new Supplier() { - @Override - public Identifier get() { - return new Tile(0, null); - } - }); - registeredIdentifiers.put("mincraft:entity", new Supplier() { - @Override - public Identifier get() { - return new MovableEntity(0, null); - } - }); - } - - protected final int dimId; - - public static void registerType(String type, Supplier constructor) { - if (constructor == null) throw new NullPointerException("constructor"); - if (constructor.get() == null) throw new NullPointerException("constructor.get()"); - registeredIdentifiers.put(type, constructor); - } - - public static Identifier getFor(Object obj) { - if (obj == null) throw new NullPointerException("obj"); - if (obj instanceof TileEntity) { - return Tile.create((TileEntity) obj); - } - if (obj instanceof Entity) { - return MovableEntity.create((Entity) obj); - } - if (obj instanceof NBTTagCompound) { - NBTTagCompound nbt = (NBTTagCompound) obj; - String type = nbt.getString("type"); - if (!registeredIdentifiers.containsKey(type)) return null; - return registeredIdentifiers.get(type).get().load(nbt.getCompoundTag("data")); - } - throw new IllegalArgumentException("Unknown type " + obj.getClass()); - } - - public static NBTTagCompound save(Identifier ident) { - NBTTagCompound tag = new NBTTagCompound(); - tag.setString("type", ident.typeId()); - tag.setTag("data", ident.save()); - return tag; - } - - private Identifier(int dimId) { - this.dimId = dimId; - } - - public abstract Object getByIdentifier(MinecraftServer server); - - public abstract boolean isLoaded(MinecraftServer server); - - protected abstract Identifier load(NBTTagCompound tag); - - protected abstract NBTTagCompound save(); - - public abstract String typeId(); - - @SideOnly(Side.CLIENT) - public abstract Object getByIdentifierClient(); - - @SideOnly(Side.CLIENT) - public abstract boolean isLoadedClient(); - - public static class Tile extends Identifier { - private final BlockPos pos; - - public static Tile create(TileEntity tile) { - if (tile.getWorld() == null) throw new NullPointerException("tile.getWorld() for the tile " + tile.getClass()); - if (tile.getPos() == null) throw new NullPointerException("tile.getPos() for the tile " + tile.getClass()); - return new Tile(tile.getWorld().provider.getDimensionId(), tile.getPos()); - } - - private Tile(int dimId, BlockPos pos) { - super(dimId); - this.pos = pos; - } - - @Override - public Tile load(NBTTagCompound tag) { - int dimId = tag.getInteger("dimId"); - int[] arr = tag.getIntArray("pos"); - if (arr.length == 0) return null; - return new Tile(dimId, new BlockPos(arr[0], arr[1], arr[2])); - } - - @Override - protected NBTTagCompound save() { - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("dimId", dimId); - tag.setIntArray("pos", new int[] { pos.getX(), pos.getY(), pos.getZ() }); - return tag; - } - - @Override - public String typeId() { - return "minecraft:tile"; - } - - @Override - public TileEntity getByIdentifier(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null) return null; - return world.getTileEntity(pos); - } - - @Override - public boolean isLoaded(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null) return false; - return world.getTileEntity(pos) != null; - } - - @Override - @SideOnly(Side.CLIENT) - public TileEntity getByIdentifierClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimensionId() != dimId) return null; - return world.getTileEntity(pos); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isLoadedClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimensionId() != dimId) return false; - return world.getTileEntity(pos) != null; - } - - } - - public static class MovableEntity extends Identifier { - private final UUID uniqueId; - - public static MovableEntity create(Entity ent) { - if (ent.getEntityWorld() == null) throw new NullPointerException("ent.getEntityWorld() for the entity " + ent.getClass()); - if (ent.getPersistentID() == null) throw new NullPointerException("ent.getPersistentID() for the entity " + ent.getClass()); - return new MovableEntity(ent.getEntityWorld().provider.getDimensionId(), ent.getPersistentID()); - } - - private MovableEntity(int dimId, UUID uniqueId) { - super(dimId); - this.uniqueId = uniqueId; - } - - private Entity get(World world) { - for (Entity entity : world.loadedEntityList) { - if (entity.getPersistentID().equals(uniqueId)) { - return entity; - } - } - return null; - } - - @Override - public Entity getByIdentifier(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null || world.provider.getDimensionId() != dimId) return null; - return get(world); - } - - @Override - public boolean isLoaded(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null || world.provider.getDimensionId() != dimId) return false; - return get(world) != null; - } - - @Override - @SideOnly(Side.CLIENT) - public Entity getByIdentifierClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimensionId() != dimId) return null; - return get(world); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isLoadedClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimensionId() != dimId) return false; - return get(world) != null; - } - - @Override - protected MovableEntity load(NBTTagCompound tag) { - int dimId = tag.getInteger("dimId"); - UUID uuid = UUID.fromString(tag.getString("uuid")); - return new MovableEntity(dimId, uuid); - } - - @Override - protected NBTTagCompound save() { - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("dimId", dimId); - tag.setString("uuid", uniqueId.toString()); - return tag; - } - - @Override - public String typeId() { - return "minecraft:entity"; - } - } -} diff --git a/src/api/java/buildcraft/api/core/JavaTools.java b/src/api/java/buildcraft/api/core/JavaTools.java deleted file mode 100644 index 7b7eb513c..000000000 --- a/src/api/java/buildcraft/api/core/JavaTools.java +++ /dev/null @@ -1,39 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.util.Arrays; - -public final class JavaTools { - private JavaTools() { - - } - - public static T[] concat(T[] first, T[] second) { - T[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static int[] concat(int[] first, int[] second) { - int[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static float[] concat(float[] first, float[] second) { - float[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static String surroundWithQuotes(String stringToSurroundWithQuotes) { - return String.format("\"%s\"", stringToSurroundWithQuotes); - } - - public static String stripSurroundingQuotes(String stringToStripQuotes) { - return stringToStripQuotes.replaceAll("^\"|\"$", ""); - } -} diff --git a/src/api/java/buildcraft/api/core/SafeTimeTracker.java b/src/api/java/buildcraft/api/core/SafeTimeTracker.java deleted file mode 100644 index 9390d87e7..000000000 --- a/src/api/java/buildcraft/api/core/SafeTimeTracker.java +++ /dev/null @@ -1,68 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.world.World; - -public class SafeTimeTracker { - - private long lastMark = Long.MIN_VALUE; - private long duration = -1; - private long randomRange = 0; - private long lastRandomDelay = 0; - private long internalDelay = 1; - - /** Only use this if the delay time changes (say, if you use this to determine when a refining should be complete */ - public SafeTimeTracker() { - - } - - public SafeTimeTracker(long delay) { - internalDelay = delay; - } - - /** In many situations, it is a bad idea to have all objects of the same kind to be waiting for the exact same - * amount of time, as that can lead to some situation where they're all synchronized and got to work all at the same - * time. When created with a random range, the mark that is set when reaching the expect delay will be added with a - * random number between [0, range[, meaning that the event will take between 0 and range more tick to run. */ - public SafeTimeTracker(long delay, long random) { - internalDelay = delay; - randomRange = random; - } - - public boolean markTimeIfDelay(World world) { - return markTimeIfDelay(world, internalDelay); - } - - /** Return true if a given delay has passed since last time marked was called successfully. */ - public boolean markTimeIfDelay(World world, long delay) { - if (world == null) { - return false; - } - - long currentTime = world.getTotalWorldTime(); - - if (currentTime < lastMark) { - lastMark = currentTime; - return false; - } else if (lastMark + delay + lastRandomDelay <= currentTime) { - duration = currentTime - lastMark; - lastMark = currentTime; - lastRandomDelay = (int) (Math.random() * randomRange); - - return true; - } else { - return false; - } - } - - public long durationOfLastDelay() { - return duration > 0 ? duration : 0; - } - - public void markTime(World world) { - lastMark = world.getTotalWorldTime(); - } -} diff --git a/src/api/java/buildcraft/api/core/StackKey.java b/src/api/java/buildcraft/api/core/StackKey.java deleted file mode 100644 index 13a8e8989..000000000 --- a/src/api/java/buildcraft/api/core/StackKey.java +++ /dev/null @@ -1,125 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; - -/** This class is used whenever stacks needs to be stored as keys. */ -public final class StackKey { - public final ItemStack stack; - public final FluidStack fluidStack; - - public StackKey(FluidStack fluidStack) { - this(null, fluidStack); - } - - public StackKey(ItemStack stack) { - this(stack, null); - } - - public StackKey(ItemStack stack, FluidStack fluidStack) { - this.stack = stack; - this.fluidStack = fluidStack; - } - - public static StackKey stack(Item item, int amount, int damage) { - return new StackKey(new ItemStack(item, amount, damage)); - } - - public static StackKey stack(Block block, int amount, int damage) { - return new StackKey(new ItemStack(block, amount, damage)); - } - - public static StackKey stack(Item item) { - return new StackKey(new ItemStack(item, 1, 0)); - } - - public static StackKey stack(Block block) { - return new StackKey(new ItemStack(block, 1, 0)); - } - - public static StackKey stack(ItemStack itemStack) { - return new StackKey(itemStack); - } - - public static StackKey fluid(Fluid fluid, int amount) { - return new StackKey(new FluidStack(fluid, amount)); - } - - public static StackKey fluid(Fluid fluid) { - return new StackKey(new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME)); - } - - public static StackKey fluid(FluidStack fluidStack) { - return new StackKey(fluidStack); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || o.getClass() != StackKey.class) { - return false; - } - StackKey k = (StackKey) o; - if ((stack == null ^ k.stack == null) || (fluidStack == null ^ k.fluidStack == null)) { - return false; - } - if (stack != null) { - if (stack.getItem() != k.stack.getItem() || stack.getHasSubtypes() && stack.getItemDamage() != k.stack.getItemDamage() || !objectsEqual( - stack.getTagCompound(), k.stack.getTagCompound())) { - return false; - } - } - if (fluidStack != null) { - if (fluidStack.getFluid().getID() != k.fluidStack.getFluid().getID() || fluidStack.amount != k.fluidStack.amount || !objectsEqual( - fluidStack.tag, k.fluidStack.tag)) { - return false; - } - } - return true; - } - - @Override - public int hashCode() { - int result = 7; - if (stack != null) { - result = 31 * result + stack.getItem().hashCode(); - result = 31 * result + stack.getItemDamage(); - result = 31 * result + objectHashCode(stack.getTagCompound()); - } - result = 31 * result + 7; - if (fluidStack != null) { - result = 31 * result + fluidStack.getFluid().getID(); - result = 31 * result + fluidStack.amount; - result = 31 * result + objectHashCode(fluidStack.tag); - } - return result; - } - - private boolean objectsEqual(Object o1, Object o2) { - if (o1 == null && o2 == null) { - return true; - } else if (o1 == null || o2 == null) { - return false; - } else { - return o1.equals(o2); - } - } - - private int objectHashCode(Object o) { - return o != null ? o.hashCode() : 0; - } - - public StackKey copy() { - return new StackKey(stack != null ? stack.copy() : null, fluidStack != null ? fluidStack.copy() : null); - } -} diff --git a/src/api/java/buildcraft/api/core/package-info.java b/src/api/java/buildcraft/api/core/package-info.java deleted file mode 100644 index f0b642a91..000000000 --- a/src/api/java/buildcraft/api/core/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.1", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core") -package buildcraft.api.core; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/core/render/ICullable.java b/src/api/java/buildcraft/api/core/render/ICullable.java deleted file mode 100644 index ea4b1f444..000000000 --- a/src/api/java/buildcraft/api/core/render/ICullable.java +++ /dev/null @@ -1,27 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.core.render; - -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.IBlockAccess; - -/* This interface designates a block as a state machine responsible for culling For implementation details look into - * FakeBlock implementation */ -public interface ICullable { - - // Side Rendering States - // They are used to effectively cull obstructed sides while processing facades. - // Make sure your implementation is correct otherwise expect FPS drop - - void setRenderSide(EnumFacing side, boolean render); - - void setRenderAllSides(); - - boolean shouldSideBeRendered(IBlockAccess blockAccess, BlockPos pos, int side); - - void setRenderMask(int mask); - -} diff --git a/src/api/java/buildcraft/api/core/render/ITextureStateManager.java b/src/api/java/buildcraft/api/core/render/ITextureStateManager.java deleted file mode 100644 index e401b3e2e..000000000 --- a/src/api/java/buildcraft/api/core/render/ITextureStateManager.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.core.render; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -public interface ITextureStateManager { - void set(TextureAtlasSprite icon); -} diff --git a/src/api/java/buildcraft/api/core/render/ITextureStates.java b/src/api/java/buildcraft/api/core/render/ITextureStates.java deleted file mode 100644 index 593534f6c..000000000 --- a/src/api/java/buildcraft/api/core/render/ITextureStates.java +++ /dev/null @@ -1,18 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.core.render; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -public interface ITextureStates extends ICullable { - - ITextureStateManager getTextureState(); - - TextureAtlasSprite getIcon(int side, int meta); - - Block getBlock(); - -} diff --git a/src/api/java/buildcraft/api/crops/CropManager.java b/src/api/java/buildcraft/api/crops/CropManager.java deleted file mode 100644 index 3d512a710..000000000 --- a/src/api/java/buildcraft/api/crops/CropManager.java +++ /dev/null @@ -1,79 +0,0 @@ -package buildcraft.api.crops; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public final class CropManager { - private static List handlers = new ArrayList(); - private static ICropHandler defaultHandler; - - private CropManager() { - - } - - public static void registerHandler(ICropHandler cropHandler) { - handlers.add(cropHandler); - } - - public static void setDefaultHandler(ICropHandler cropHandler) { - defaultHandler = cropHandler; - } - - public static ICropHandler getDefaultHandler() { - return defaultHandler; - } - - public static boolean isSeed(ItemStack stack) { - for (ICropHandler cropHandler : handlers) { - if (cropHandler.isSeed(stack)) { - return true; - } - } - return defaultHandler.isSeed(stack); - } - - public static boolean canSustainPlant(World world, ItemStack seed, BlockPos pos) { - for (ICropHandler cropHandler : handlers) { - if (cropHandler.isSeed(seed) && cropHandler.canSustainPlant(world, seed, pos)) { - return true; - } - } - return defaultHandler.isSeed(seed) && defaultHandler.canSustainPlant(world, seed, pos); - } - - public static boolean plantCrop(World world, EntityPlayer player, ItemStack seed, BlockPos pos) { - for (ICropHandler cropHandler : handlers) { - if (cropHandler.isSeed(seed) && cropHandler.canSustainPlant(world, seed, pos) && cropHandler.plantCrop(world, player, seed, pos)) { - return true; - } - } - return defaultHandler.plantCrop(world, player, seed, pos); - } - - public static boolean isMature(IBlockAccess blockAccess, IBlockState state, BlockPos pos) { - for (ICropHandler cropHandler : handlers) { - if (cropHandler.isMature(blockAccess, state, pos)) { - return true; - } - } - return defaultHandler.isMature(blockAccess, state, pos); - } - - public static boolean harvestCrop(World world, BlockPos pos, List drops) { - IBlockState state = world.getBlockState(pos); - for (ICropHandler cropHandler : handlers) { - if (cropHandler.isMature(world, state, pos)) { - return cropHandler.harvestCrop(world, pos, drops); - } - } - return defaultHandler.isMature(world, state, pos) && defaultHandler.harvestCrop(world, pos, drops); - } - -} diff --git a/src/api/java/buildcraft/api/crops/ICropHandler.java b/src/api/java/buildcraft/api/crops/ICropHandler.java deleted file mode 100644 index 45d9b9733..000000000 --- a/src/api/java/buildcraft/api/crops/ICropHandler.java +++ /dev/null @@ -1,54 +0,0 @@ -package buildcraft.api.crops; - -import java.util.List; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public interface ICropHandler { - - /** Check if an item is a seed. - * - * @param stack - * @return true if the item can be planted. */ - boolean isSeed(ItemStack stack); - - /** Check if the item can be planted. You can assume canSustainPlant() will only be called if isSeed() returned - * true. - * - * @param world - * @param seed - * @param pos - * @return true if the item can be planted at pos. */ - boolean canSustainPlant(World world, ItemStack seed, BlockPos pos); - - /** Plant the item in the block. You can assume plantCrop() will only be called if canSustainPlant() returned true. - * - * @param world - * @param player - * @param seed - * @param pos - * @return true if the item was planted at pos. */ - boolean plantCrop(World world, EntityPlayer player, ItemStack seed, BlockPos pos); - - /** Check if a crop is mature and can be harvested. - * - * @param blockAccess - * @param state - * @param pos - * @return true if the block at pos is mature and can be harvested. */ - boolean isMature(IBlockAccess blockAccess, IBlockState state, BlockPos pos); - - /** Harvest the crop. You can assume harvestCrop() will only be called if isMature() returned true. - * - * @param world - * @param pos - * @param drops a list to return the harvest's drops. - * @return true if the block was successfully harvested. */ - boolean harvestCrop(World world, BlockPos pos, List drops); - -} diff --git a/src/api/java/buildcraft/api/crops/package-info.java b/src/api/java/buildcraft/api/crops/package-info.java deleted file mode 100644 index 803ce050a..000000000 --- a/src/api/java/buildcraft/api/crops/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.1", owner = "BuildCraftAPI|Core", provides = "BuildCraftAPI|crops") -package buildcraft.api.crops; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/enums/EnumBlueprintType.java b/src/api/java/buildcraft/api/enums/EnumBlueprintType.java deleted file mode 100644 index 8d6217797..000000000 --- a/src/api/java/buildcraft/api/enums/EnumBlueprintType.java +++ /dev/null @@ -1,29 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.item.ItemStack; - -import buildcraft.api.items.IBlueprintItem; - -public enum EnumBlueprintType { - NONE, - BLUEPRINT, - TEMPLATE; - - public static EnumBlueprintType valueOf(int index) { - if (index <= 0 || index >= values().length) { - return NONE; - } else { - return values()[index]; - } - } - - public static EnumBlueprintType getType(ItemStack item) { - if (item == null) { - return NONE; - } else if (item.getItem() instanceof IBlueprintItem) { - return ((IBlueprintItem) item.getItem()).getType(item); - } else { - return NONE; - } - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java b/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java deleted file mode 100644 index 0956fa11e..000000000 --- a/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java +++ /dev/null @@ -1,24 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.util.IStringSerializable; - -public enum EnumDecoratedBlock implements IStringSerializable { - DESTROY(0), - BLUEPRINT(10), - TEMPLATE(10), - PAPER(10), - LEATHER(10); - - public final int lightValue; - - private EnumDecoratedBlock(int lightValue) { - this.lightValue = lightValue; - } - - @Override - public String getName() { - return name().toLowerCase(Locale.ROOT); - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumEnergyStage.java b/src/api/java/buildcraft/api/enums/EnumEnergyStage.java deleted file mode 100644 index dd809fea8..000000000 --- a/src/api/java/buildcraft/api/enums/EnumEnergyStage.java +++ /dev/null @@ -1,24 +0,0 @@ -package buildcraft.api.enums; - -import org.apache.commons.lang3.StringUtils; - -import net.minecraft.util.IStringSerializable; - -public enum EnumEnergyStage implements IStringSerializable { - BLUE, - GREEN, - YELLOW, - RED, - OVERHEAT, - BLACK; - public static final EnumEnergyStage[] VALUES = values(); - - public String getModelName() { - return StringUtils.lowerCase(name()); - } - - @Override - public String getName() { - return getModelName(); - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumEngineType.java b/src/api/java/buildcraft/api/enums/EnumEngineType.java deleted file mode 100644 index f2be6833e..000000000 --- a/src/api/java/buildcraft/api/enums/EnumEngineType.java +++ /dev/null @@ -1,27 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.util.IStringSerializable; - -public enum EnumEngineType implements IStringSerializable { - WOOD("core", "wood"), - STONE("energy", "stone"), - IRON("energy", "iron"), - CREATIVE("energy", "creative"); - - public final String resourceLocation; - - EnumEngineType(String mod, String loc) { - resourceLocation = "buildcraft" + mod + ":blocks/engine/inv/" + loc + "/"; - } - - @Override - public String getName() { - return name(); - } - - public String getModelName() { - return getName().toLowerCase(Locale.ROOT); - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumFillerPattern.java b/src/api/java/buildcraft/api/enums/EnumFillerPattern.java deleted file mode 100644 index 4570f0c79..000000000 --- a/src/api/java/buildcraft/api/enums/EnumFillerPattern.java +++ /dev/null @@ -1,28 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.util.IStringSerializable; - -public enum EnumFillerPattern implements IStringSerializable { - NONE, - BOX, - CLEAR, - CYLINDER, - FILL, - FLATTEN, - FRAME, - HORIZON, - PYRAMID, - STAIRS; - - @Override - public String toString() { - return getName(); - } - - @Override - public String getName() { - return name().toLowerCase(Locale.ROOT); - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumLaserTableType.java b/src/api/java/buildcraft/api/enums/EnumLaserTableType.java deleted file mode 100644 index cc8b41e7d..000000000 --- a/src/api/java/buildcraft/api/enums/EnumLaserTableType.java +++ /dev/null @@ -1,24 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.IStringSerializable; - -import buildcraft.api.properties.BuildCraftProperties; - -public enum EnumLaserTableType implements IStringSerializable { - ASSEMBLY_TABLE, - ADVANCED_CRAFTING_TABLE, - INTEGRATION_TABLE, - CHARGING_TABLE, - PROGRAMMING_TABLE, - STAMPING_TABLE; - - public static EnumLaserTableType getType(IBlockState state) { - return (EnumLaserTableType) state.getValue(BuildCraftProperties.LASER_TABLE_TYPE); - } - - @Override - public String getName() { - return name(); - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumMachineState.java b/src/api/java/buildcraft/api/enums/EnumMachineState.java deleted file mode 100644 index 6a215c235..000000000 --- a/src/api/java/buildcraft/api/enums/EnumMachineState.java +++ /dev/null @@ -1,21 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.IStringSerializable; - -import buildcraft.api.properties.BuildCraftProperties; - -public enum EnumMachineState implements IStringSerializable { - OFF, - ON, - DONE; - - public static EnumMachineState getType(IBlockState state) { - return (EnumMachineState) state.getValue(BuildCraftProperties.MACHINE_STATE); - } - - @Override - public String getName() { - return name(); - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumRedstoneChipset.java b/src/api/java/buildcraft/api/enums/EnumRedstoneChipset.java deleted file mode 100644 index 68ecb2515..000000000 --- a/src/api/java/buildcraft/api/enums/EnumRedstoneChipset.java +++ /dev/null @@ -1,42 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public enum EnumRedstoneChipset { - RED, - IRON, - GOLD, - DIAMOND, - PULSATING, - QUARTZ, - COMP, - EMERALD; - - public ItemStack getStack(int stackSize) { - Item chipset = Item.getByNameOrId("buildcraft|silicon:redstoneChipset"); - if (chipset == null) { - return null; - } - - return new ItemStack(chipset, stackSize, ordinal()); - } - - public ItemStack getStack() { - return getStack(1); - } - - public static EnumRedstoneChipset fromStack(ItemStack stack) { - if (stack == null) { - return RED; - } - return fromOrdinal(stack.getMetadata()); - } - - public static EnumRedstoneChipset fromOrdinal(int ordinal) { - if (ordinal < 0 || ordinal >= values().length) { - return RED; - } - return values()[ordinal]; - } -} diff --git a/src/api/java/buildcraft/api/enums/EnumSpring.java b/src/api/java/buildcraft/api/enums/EnumSpring.java deleted file mode 100644 index f7409b339..000000000 --- a/src/api/java/buildcraft/api/enums/EnumSpring.java +++ /dev/null @@ -1,32 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; -import net.minecraft.util.IStringSerializable; - -import buildcraft.api.properties.BuildCraftProperties; - -public enum EnumSpring implements IStringSerializable { - - WATER(5, -1, Blocks.water.getDefaultState()), - OIL(6000, 8, null); // Set in BuildCraftEnergy - public static final EnumSpring[] VALUES = values(); - public final int tickRate, chance; - public IBlockState liquidBlock; - public boolean canGen = true; - - private EnumSpring(int tickRate, int chance, IBlockState liquidBlock) { - this.tickRate = tickRate; - this.chance = chance; - this.liquidBlock = liquidBlock; - } - - public static EnumSpring fromState(IBlockState state) { - return (EnumSpring) state.getValue(BuildCraftProperties.SPRING_TYPE); - } - - @Override - public String getName() { - return this.name(); - } -} diff --git a/src/api/java/buildcraft/api/enums/package-info.java b/src/api/java/buildcraft/api/enums/package-info.java deleted file mode 100644 index 8c585be95..000000000 --- a/src/api/java/buildcraft/api/enums/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|enums") -package buildcraft.api.enums; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/events/BlockInteractionEvent.java b/src/api/java/buildcraft/api/events/BlockInteractionEvent.java deleted file mode 100644 index e9bede1c2..000000000 --- a/src/api/java/buildcraft/api/events/BlockInteractionEvent.java +++ /dev/null @@ -1,21 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.events; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; - -@Cancelable -public class BlockInteractionEvent extends Event { - public final EntityPlayer player; - public final IBlockState state; - - public BlockInteractionEvent(EntityPlayer player, IBlockState state) { - this.player = player; - this.state = state; - } -} diff --git a/src/api/java/buildcraft/api/events/BlockPlacedDownEvent.java b/src/api/java/buildcraft/api/events/BlockPlacedDownEvent.java deleted file mode 100644 index da1b9696d..000000000 --- a/src/api/java/buildcraft/api/events/BlockPlacedDownEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.events; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; - -@Cancelable -public class BlockPlacedDownEvent extends Event { - public final EntityPlayer player; - public final IBlockState state; - public final BlockPos pos; - - public BlockPlacedDownEvent(EntityPlayer player, BlockPos pos, IBlockState state) { - this.player = player; - this.state = state; - this.pos = pos; - } -} diff --git a/src/api/java/buildcraft/api/events/PipePlacedEvent.java b/src/api/java/buildcraft/api/events/PipePlacedEvent.java deleted file mode 100644 index 415bdcf44..000000000 --- a/src/api/java/buildcraft/api/events/PipePlacedEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.events; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; - -import net.minecraftforge.fml.common.eventhandler.Event; - -public class PipePlacedEvent extends Event { - public EntityPlayer player; - public Item pipeType; - public BlockPos pos; - - public PipePlacedEvent(EntityPlayer player, Item pipeType, BlockPos pos) { - this.player = player; - this.pipeType = pipeType; - this.pos = pos; - } - -} diff --git a/src/api/java/buildcraft/api/events/RobotEvent.java b/src/api/java/buildcraft/api/events/RobotEvent.java deleted file mode 100644 index 9b12b64d2..000000000 --- a/src/api/java/buildcraft/api/events/RobotEvent.java +++ /dev/null @@ -1,53 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.events; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; - -import buildcraft.api.robots.EntityRobotBase; - -public abstract class RobotEvent extends Event { - public final EntityRobotBase robot; - - public RobotEvent(EntityRobotBase robot) { - this.robot = robot; - } - - @Cancelable - public static class Place extends RobotEvent { - public final EntityPlayer player; - - public Place(EntityRobotBase robot, EntityPlayer player) { - super(robot); - this.player = player; - } - } - - @Cancelable - public static class Interact extends RobotEvent { - public final EntityPlayer player; - public final ItemStack item; - - public Interact(EntityRobotBase robot, EntityPlayer player, ItemStack item) { - super(robot); - this.player = player; - this.item = item; - } - } - - @Cancelable - public static class Dismantle extends RobotEvent { - public final EntityPlayer player; - - public Dismantle(EntityRobotBase robot, EntityPlayer player) { - super(robot); - this.player = player; - } - } -} diff --git a/src/api/java/buildcraft/api/events/RobotPlacementEvent.java b/src/api/java/buildcraft/api/events/RobotPlacementEvent.java deleted file mode 100644 index fe4128e7e..000000000 --- a/src/api/java/buildcraft/api/events/RobotPlacementEvent.java +++ /dev/null @@ -1,21 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.events; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; - -@Cancelable -public class RobotPlacementEvent extends Event { - public EntityPlayer player; - public String robotProgram; - - public RobotPlacementEvent(EntityPlayer player, String robotProgram) { - this.player = player; - this.robotProgram = robotProgram; - } - -} diff --git a/src/api/java/buildcraft/api/events/package-info.java b/src/api/java/buildcraft/api/events/package-info.java deleted file mode 100644 index 06cd25fea..000000000 --- a/src/api/java/buildcraft/api/events/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|events") -package buildcraft.api.events; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/facades/FacadeAPI.java b/src/api/java/buildcraft/api/facades/FacadeAPI.java deleted file mode 100644 index b3e214ea8..000000000 --- a/src/api/java/buildcraft/api/facades/FacadeAPI.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.facades; - -public final class FacadeAPI { - public static IFacadeItem facadeItem; - - private FacadeAPI() { - - } -} diff --git a/src/api/java/buildcraft/api/facades/FacadeType.java b/src/api/java/buildcraft/api/facades/FacadeType.java deleted file mode 100644 index c88d89ff4..000000000 --- a/src/api/java/buildcraft/api/facades/FacadeType.java +++ /dev/null @@ -1,14 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.facades; - -public enum FacadeType { - Basic, - Phased; - - public static FacadeType fromOrdinal(int ordinal) { - return ordinal == 1 ? Phased : Basic; - } -} diff --git a/src/api/java/buildcraft/api/facades/IFacadeItem.java b/src/api/java/buildcraft/api/facades/IFacadeItem.java deleted file mode 100644 index 1fe981a3b..000000000 --- a/src/api/java/buildcraft/api/facades/IFacadeItem.java +++ /dev/null @@ -1,16 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.facades; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemStack; - -public interface IFacadeItem { - FacadeType getFacadeType(ItemStack facade); - - ItemStack getFacadeForBlock(IBlockState state); - - IBlockState[] getBlockStatesForFacade(ItemStack facade); -} diff --git a/src/api/java/buildcraft/api/facades/package-info.java b/src/api/java/buildcraft/api/facades/package-info.java deleted file mode 100644 index 2c79167b3..000000000 --- a/src/api/java/buildcraft/api/facades/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|facades") -package buildcraft.api.facades; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/filler/FillerManager.java b/src/api/java/buildcraft/api/filler/FillerManager.java deleted file mode 100644 index 03567c45a..000000000 --- a/src/api/java/buildcraft/api/filler/FillerManager.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.filler; - -public final class FillerManager { - - public static IFillerRegistry registry; - - /** Deactivate constructor */ - private FillerManager() {} -} diff --git a/src/api/java/buildcraft/api/filler/IFillerPattern.java b/src/api/java/buildcraft/api/filler/IFillerPattern.java deleted file mode 100644 index 7d89469f1..000000000 --- a/src/api/java/buildcraft/api/filler/IFillerPattern.java +++ /dev/null @@ -1,11 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.filler; - -import buildcraft.api.statements.IStatement; - -public interface IFillerPattern extends IStatement { - // Object getBlockOverlay(); -} diff --git a/src/api/java/buildcraft/api/filler/IFillerRegistry.java b/src/api/java/buildcraft/api/filler/IFillerRegistry.java deleted file mode 100644 index f9e588f62..000000000 --- a/src/api/java/buildcraft/api/filler/IFillerRegistry.java +++ /dev/null @@ -1,19 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.filler; - -import java.util.Collection; - -public interface IFillerRegistry { - void addPattern(IFillerPattern pattern); - - IFillerPattern getPattern(String patternName); - - IFillerPattern getNextPattern(IFillerPattern currentPattern); - - IFillerPattern getPreviousPattern(IFillerPattern currentPattern); - - Collection getPatterns(); -} diff --git a/src/api/java/buildcraft/api/filler/package-info.java b/src/api/java/buildcraft/api/filler/package-info.java deleted file mode 100644 index 3e9d907de..000000000 --- a/src/api/java/buildcraft/api/filler/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "4.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|filler") -package buildcraft.api.filler; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java b/src/api/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java deleted file mode 100644 index 545ac3d3b..000000000 --- a/src/api/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -public final class BuildcraftFuelRegistry { - public static IFuelManager fuel; - public static ICoolantManager coolant; - - private BuildcraftFuelRegistry() {} -} diff --git a/src/api/java/buildcraft/api/fuels/ICoolant.java b/src/api/java/buildcraft/api/fuels/ICoolant.java deleted file mode 100644 index 5d038c8d5..000000000 --- a/src/api/java/buildcraft/api/fuels/ICoolant.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -import net.minecraftforge.fluids.Fluid; - -public interface ICoolant { - Fluid getFluid(); - - float getDegreesCoolingPerMB(float heat); -} diff --git a/src/api/java/buildcraft/api/fuels/ICoolantManager.java b/src/api/java/buildcraft/api/fuels/ICoolantManager.java deleted file mode 100644 index 849bf1acf..000000000 --- a/src/api/java/buildcraft/api/fuels/ICoolantManager.java +++ /dev/null @@ -1,29 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -import java.util.Collection; - -import net.minecraftforge.fluids.Fluid; - -import buildcraft.api.core.StackKey; - -public interface ICoolantManager { - ICoolant addCoolant(ICoolant coolant); - - ICoolant addCoolant(Fluid fluid, float degreesCoolingPerMB); - - ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); - - ISolidCoolant addSolidCoolant(StackKey solid, StackKey liquid, float multiplier); - - Collection getCoolants(); - - Collection getSolidCoolants(); - - ICoolant getCoolant(Fluid fluid); - - ISolidCoolant getSolidCoolant(StackKey solid); -} diff --git a/src/api/java/buildcraft/api/fuels/IFuel.java b/src/api/java/buildcraft/api/fuels/IFuel.java deleted file mode 100644 index a2590c608..000000000 --- a/src/api/java/buildcraft/api/fuels/IFuel.java +++ /dev/null @@ -1,15 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -import net.minecraftforge.fluids.Fluid; - -public interface IFuel { - Fluid getFluid(); - - int getTotalBurningTime(); - - int getPowerPerCycle(); -} diff --git a/src/api/java/buildcraft/api/fuels/IFuelManager.java b/src/api/java/buildcraft/api/fuels/IFuelManager.java deleted file mode 100644 index 367818270..000000000 --- a/src/api/java/buildcraft/api/fuels/IFuelManager.java +++ /dev/null @@ -1,27 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -import java.util.Collection; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -public interface IFuelManager { - IFuel addFuel(IFuel fuel); - - IFuel addFuel(Fluid fluid, int powerPerCycle, int totalBurningTime); - - IDirtyFuel addDirtyFuel(Fluid fuel, int powerPerCycle, int totalBurningTime, FluidStack residue); - - Collection getFuels(); - - IFuel getFuel(Fluid fluid); - - public interface IDirtyFuel extends IFuel { - /** @return The residue fluidstack, per bucket of original fuel. */ - FluidStack getResidue(); - } -} diff --git a/src/api/java/buildcraft/api/fuels/ISolidCoolant.java b/src/api/java/buildcraft/api/fuels/ISolidCoolant.java deleted file mode 100644 index ab41cc46d..000000000 --- a/src/api/java/buildcraft/api/fuels/ISolidCoolant.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public interface ISolidCoolant { - FluidStack getFluidFromSolidCoolant(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/fuels/package-info.java b/src/api/java/buildcraft/api/fuels/package-info.java deleted file mode 100644 index 93d524dbf..000000000 --- a/src/api/java/buildcraft/api/fuels/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|fuels") -package buildcraft.api.fuels; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/gates/GateExpansionController.java b/src/api/java/buildcraft/api/gates/GateExpansionController.java deleted file mode 100644 index 749de86f7..000000000 --- a/src/api/java/buildcraft/api/gates/GateExpansionController.java +++ /dev/null @@ -1,54 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.gates; - -import java.util.List; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -import buildcraft.api.statements.IActionInternal; -import buildcraft.api.statements.IStatement; -import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.ITriggerInternal; - -public abstract class GateExpansionController { - - public final IGateExpansion type; - public final TileEntity pipeTile; - - public GateExpansionController(IGateExpansion type, TileEntity pipeTile) { - this.pipeTile = pipeTile; - this.type = type; - } - - public IGateExpansion getType() { - return type; - } - - public boolean isActive() { - return false; - } - - public void tick(IGate gate) {} - - public void startResolution() {} - - public boolean resolveAction(IStatement action, int count) { - return false; - } - - public boolean isTriggerActive(IStatement trigger, IStatementParameter[] parameters) { - return false; - } - - public void addTriggers(List list) {} - - public void addActions(List list) {} - - public void writeToNBT(NBTTagCompound nbt) {} - - public void readFromNBT(NBTTagCompound nbt) {} -} diff --git a/src/api/java/buildcraft/api/gates/GateExpansionModelKey.java b/src/api/java/buildcraft/api/gates/GateExpansionModelKey.java deleted file mode 100644 index 85763f19d..000000000 --- a/src/api/java/buildcraft/api/gates/GateExpansionModelKey.java +++ /dev/null @@ -1,36 +0,0 @@ -package buildcraft.api.gates; - -import java.util.Arrays; - -import net.minecraft.util.EnumWorldBlockLayer; - -public class GateExpansionModelKey> { - public final EnumWorldBlockLayer layer; - public final IExpansionBaker baker; - private final int hash; - - public GateExpansionModelKey(EnumWorldBlockLayer layer, IExpansionBaker baker) { - if (layer != EnumWorldBlockLayer.CUTOUT && layer != EnumWorldBlockLayer.TRANSLUCENT) { - throw new IllegalArgumentException("Unsuported layer! Was " + layer + ", wanted CUTOUT or TRANSLUCENT"); - } - if (baker == null) throw new NullPointerException("baker"); - this.layer = layer; - this.baker = baker; - hash = Arrays.hashCode(new int[] { layer.hashCode(), System.identityHashCode(baker) }); - } - - @Override - public int hashCode() { - return hash; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - GateExpansionModelKey other = (GateExpansionModelKey) obj; - if (baker != other.baker) return false; - return true; - } -} diff --git a/src/api/java/buildcraft/api/gates/GateExpansions.java b/src/api/java/buildcraft/api/gates/GateExpansions.java deleted file mode 100644 index b1e600371..000000000 --- a/src/api/java/buildcraft/api/gates/GateExpansions.java +++ /dev/null @@ -1,61 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.gates; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import com.google.common.collect.HashBiMap; - -import net.minecraft.item.ItemStack; - -public final class GateExpansions { - private static final Map expansions = new HashMap(); - private static final ArrayList expansionIDs = new ArrayList(); - private static final Map recipes = HashBiMap.create(); - - private GateExpansions() {} - - public static void registerExpansion(IGateExpansion expansion) { - registerExpansion(expansion.getUniqueIdentifier(), expansion); - } - - public static void registerExpansion(String identifier, IGateExpansion expansion) { - expansions.put(identifier, expansion); - expansionIDs.add(expansion); - } - - public static void registerExpansion(IGateExpansion expansion, ItemStack addedRecipe) { - registerExpansion(expansion.getUniqueIdentifier(), expansion); - recipes.put(expansion, addedRecipe); - } - - public static IGateExpansion getExpansion(String identifier) { - return expansions.get(identifier); - } - - public static Set getExpansions() { - Set set = new HashSet(); - set.addAll(expansionIDs); - return set; - } - - public static Map getRecipesForPostInit() { - return recipes; - } - - // The code below is used by networking. - - public static IGateExpansion getExpansionByID(int id) { - return expansionIDs.get(id); - } - - public static int getExpansionID(IGateExpansion expansion) { - return expansionIDs.indexOf(expansion); - } -} diff --git a/src/api/java/buildcraft/api/gates/IExpansionBaker.java b/src/api/java/buildcraft/api/gates/IExpansionBaker.java deleted file mode 100644 index 846cfe598..000000000 --- a/src/api/java/buildcraft/api/gates/IExpansionBaker.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.gates; - -import com.google.common.collect.ImmutableList; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.vertex.VertexFormat; - -public interface IExpansionBaker> { - /** @return The vertex format used to generate the quads. */ - VertexFormat getVertexFormat(); - - ImmutableList bake(K key); -} diff --git a/src/api/java/buildcraft/api/gates/IGate.java b/src/api/java/buildcraft/api/gates/IGate.java deleted file mode 100644 index df2364937..000000000 --- a/src/api/java/buildcraft/api/gates/IGate.java +++ /dev/null @@ -1,30 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.gates; - -import java.util.List; - -import buildcraft.api.statements.IStatement; -import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.StatementSlot; -import buildcraft.api.statements.containers.ISidedStatementContainer; -import buildcraft.api.transport.IPipe; - -public interface IGate extends ISidedStatementContainer { - @Deprecated - void setPulsing(boolean pulse); - - IPipe getPipe(); - - List getTriggers(); - - List getActions(); - - List getActiveActions(); - - List getTriggerParameters(int index); - - List getActionParameters(int index); -} diff --git a/src/api/java/buildcraft/api/gates/IGateExpansion.java b/src/api/java/buildcraft/api/gates/IGateExpansion.java deleted file mode 100644 index 2dad21324..000000000 --- a/src/api/java/buildcraft/api/gates/IGateExpansion.java +++ /dev/null @@ -1,27 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.gates; - -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumWorldBlockLayer; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IGateExpansion { - - String getUniqueIdentifier(); - - String getDisplayName(); - - GateExpansionController makeController(TileEntity pipeTile); - - @SideOnly(Side.CLIENT) - void textureStitch(TextureMap map); - - @SideOnly(Side.CLIENT) - GateExpansionModelKey getRenderModelKey(EnumWorldBlockLayer layer); -} diff --git a/src/api/java/buildcraft/api/gates/package-info.java b/src/api/java/buildcraft/api/gates/package-info.java deleted file mode 100644 index b86ad48bd..000000000 --- a/src/api/java/buildcraft/api/gates/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "4.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|gates") -package buildcraft.api.gates; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/items/IBlueprintItem.java b/src/api/java/buildcraft/api/items/IBlueprintItem.java deleted file mode 100644 index d67bc39fd..000000000 --- a/src/api/java/buildcraft/api/items/IBlueprintItem.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.items; - -import net.minecraft.item.ItemStack; - -import buildcraft.api.enums.EnumBlueprintType; - -public interface IBlueprintItem extends INamedItem { - EnumBlueprintType getType(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/items/IItemCustomPipeRender.java b/src/api/java/buildcraft/api/items/IItemCustomPipeRender.java deleted file mode 100644 index 97847c468..000000000 --- a/src/api/java/buildcraft/api/items/IItemCustomPipeRender.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.items; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IItemCustomPipeRender { - float getPipeRenderScale(ItemStack stack); - - /** @return False to use the default renderer, true otherwise. */ - @SideOnly(Side.CLIENT) - boolean renderItemInPipe(ItemStack stack, double x, double y, double z); -} diff --git a/src/api/java/buildcraft/api/items/IList.java b/src/api/java/buildcraft/api/items/IList.java deleted file mode 100644 index 97bd77ded..000000000 --- a/src/api/java/buildcraft/api/items/IList.java +++ /dev/null @@ -1,10 +0,0 @@ -package buildcraft.api.items; - -import net.minecraft.item.ItemStack; - -public interface IList extends INamedItem { - @Deprecated - String getLabel(ItemStack stack); - - boolean matches(ItemStack stackList, ItemStack item); -} diff --git a/src/api/java/buildcraft/api/items/IMapLocation.java b/src/api/java/buildcraft/api/items/IMapLocation.java deleted file mode 100644 index 60b87af6f..000000000 --- a/src/api/java/buildcraft/api/items/IMapLocation.java +++ /dev/null @@ -1,65 +0,0 @@ -package buildcraft.api.items; - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.IBox; -import buildcraft.api.core.IZone; - -/** Created by asie on 2/28/15. */ -public interface IMapLocation extends INamedItem { - public enum MapLocationType { - CLEAN, - SPOT, - AREA, - PATH, - ZONE; - - public final int meta = ordinal(); - - public static MapLocationType getFromStack(ItemStack stack) { - int dam = stack.getItemDamage(); - if (dam < 0 || dam >= values().length) { - return MapLocationType.CLEAN; - } - return values()[dam]; - } - - public void setToStack(ItemStack stack) { - stack.setItemDamage(meta); - } - } - - /** This function can be used for SPOT types. - * - * @param stack - * @return The point representing the map location. */ - BlockPos getPoint(ItemStack stack); - - /** This function can be used for SPOT and AREA types. - * - * @param stack - * @return The box representing the map location. */ - IBox getBox(ItemStack stack); - - /** This function can be used for SPOT, AREA and ZONE types. The PATH type needs to be handled separately. - * - * @param stack - * @return An IZone representing the map location - also an instance of IBox for SPOT and AREA types. */ - IZone getZone(ItemStack stack); - - /** This function can be used for SPOT and PATH types. - * - * @param stack - * @return A list of BlockPoses representing the path the Map Location stores. */ - List getPath(ItemStack stack); - - /** This function can be used for SPOT types only. - * - * @param stack - * @return The side of the spot. */ - EnumFacing getPointSide(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/items/INamedItem.java b/src/api/java/buildcraft/api/items/INamedItem.java deleted file mode 100644 index 4080dae2f..000000000 --- a/src/api/java/buildcraft/api/items/INamedItem.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.items; - -import net.minecraft.item.ItemStack; - -public interface INamedItem { - String getName(ItemStack stack); - - boolean setName(ItemStack stack, String name); -} diff --git a/src/api/java/buildcraft/api/items/package-info.java b/src/api/java/buildcraft/api/items/package-info.java deleted file mode 100644 index f6d2835d6..000000000 --- a/src/api/java/buildcraft/api/items/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|items") -package buildcraft.api.items; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/library/ILibraryTypeHandler.java b/src/api/java/buildcraft/api/library/ILibraryTypeHandler.java deleted file mode 100644 index 8616d10fe..000000000 --- a/src/api/java/buildcraft/api/library/ILibraryTypeHandler.java +++ /dev/null @@ -1,18 +0,0 @@ -package buildcraft.api.library; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public interface ILibraryTypeHandler { - boolean isHandler(ItemStack stack, boolean store); - - String getFileExtension(); - - int getTextColor(); - - String getName(ItemStack stack); - - ItemStack load(ItemStack stack, NBTTagCompound compound); - - boolean store(ItemStack stack, NBTTagCompound compound); -} diff --git a/src/api/java/buildcraft/api/library/LibraryAPI.java b/src/api/java/buildcraft/api/library/LibraryAPI.java deleted file mode 100644 index 92e4bbc6c..000000000 --- a/src/api/java/buildcraft/api/library/LibraryAPI.java +++ /dev/null @@ -1,29 +0,0 @@ -package buildcraft.api.library; - -import java.util.HashSet; -import java.util.Set; - -public final class LibraryAPI { - private static final Set handlers = new HashSet(); - - private LibraryAPI() { - - } - - public static Set getHandlerSet() { - return handlers; - } - - public static void registerHandler(LibraryTypeHandler handler) { - handlers.add(handler); - } - - public static LibraryTypeHandler getHandlerFor(String extension) { - for (LibraryTypeHandler h : handlers) { - if (h.isInputExtension(extension)) { - return h; - } - } - return null; - } -} diff --git a/src/api/java/buildcraft/api/library/LibraryTypeHandler.java b/src/api/java/buildcraft/api/library/LibraryTypeHandler.java deleted file mode 100644 index aa4b3106f..000000000 --- a/src/api/java/buildcraft/api/library/LibraryTypeHandler.java +++ /dev/null @@ -1,30 +0,0 @@ -package buildcraft.api.library; - -import net.minecraft.item.ItemStack; - -public abstract class LibraryTypeHandler { - public enum HandlerType { - LOAD, - STORE - } - - private final String extension; - - public LibraryTypeHandler(String extension) { - this.extension = extension; - } - - public abstract boolean isHandler(ItemStack stack, HandlerType type); - - public boolean isInputExtension(String ext) { - return extension.equals(ext); - } - - public String getOutputExtension() { - return extension; - } - - public abstract int getTextColor(); - - public abstract String getName(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/library/LibraryTypeHandlerByteArray.java b/src/api/java/buildcraft/api/library/LibraryTypeHandlerByteArray.java deleted file mode 100644 index c7c5e2317..000000000 --- a/src/api/java/buildcraft/api/library/LibraryTypeHandlerByteArray.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.library; - -import net.minecraft.item.ItemStack; - -public abstract class LibraryTypeHandlerByteArray extends LibraryTypeHandler { - public LibraryTypeHandlerByteArray(String extension) { - super(extension); - } - - public abstract ItemStack load(ItemStack stack, byte[] data); - - public abstract byte[] store(ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/library/LibraryTypeHandlerNBT.java b/src/api/java/buildcraft/api/library/LibraryTypeHandlerNBT.java deleted file mode 100644 index a656ff7c7..000000000 --- a/src/api/java/buildcraft/api/library/LibraryTypeHandlerNBT.java +++ /dev/null @@ -1,14 +0,0 @@ -package buildcraft.api.library; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public abstract class LibraryTypeHandlerNBT extends LibraryTypeHandler { - public LibraryTypeHandlerNBT(String extension) { - super(extension); - } - - public abstract ItemStack load(ItemStack stack, NBTTagCompound nbt); - - public abstract boolean store(ItemStack stack, NBTTagCompound nbt); -} diff --git a/src/api/java/buildcraft/api/library/package-info.java b/src/api/java/buildcraft/api/library/package-info.java deleted file mode 100644 index e41a0dc0f..000000000 --- a/src/api/java/buildcraft/api/library/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|library") -package buildcraft.api.library; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/lists/ListMatchHandler.java b/src/api/java/buildcraft/api/lists/ListMatchHandler.java deleted file mode 100644 index adc332891..000000000 --- a/src/api/java/buildcraft/api/lists/ListMatchHandler.java +++ /dev/null @@ -1,26 +0,0 @@ -package buildcraft.api.lists; - -import java.util.List; -import net.minecraft.item.ItemStack; - -public abstract class ListMatchHandler { - public enum Type { - TYPE, - MATERIAL, - CLASS - } - - public abstract boolean matches(Type type, ItemStack stack, ItemStack target, boolean precise); - - public abstract boolean isValidSource(Type type, ItemStack stack); - - /** Get custom client examples. - * - * @param type - * @param stack - * @return A List (even empty!) if the examples satisfy this handler, null if iteration and .matches should be used - * instead. */ - public List getClientExamples(Type type, ItemStack stack) { - return null; - } -} diff --git a/src/api/java/buildcraft/api/lists/ListRegistry.java b/src/api/java/buildcraft/api/lists/ListRegistry.java deleted file mode 100644 index 5c7be2384..000000000 --- a/src/api/java/buildcraft/api/lists/ListRegistry.java +++ /dev/null @@ -1,26 +0,0 @@ -package buildcraft.api.lists; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.minecraft.item.Item; - -public final class ListRegistry { - public static final List> itemClassAsType = new ArrayList>(); - private static final List handlers = new ArrayList(); - - private ListRegistry() { - - } - - public static void registerHandler(ListMatchHandler h) { - if (h != null) { - handlers.add(h); - } - } - - public static List getHandlers() { - return Collections.unmodifiableList(handlers); - } -} diff --git a/src/api/java/buildcraft/api/lists/package-info.java b/src/api/java/buildcraft/api/lists/package-info.java deleted file mode 100644 index 603c33587..000000000 --- a/src/api/java/buildcraft/api/lists/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|lists") -package buildcraft.api.lists; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/package-info.java b/src/api/java/buildcraft/api/package-info.java deleted file mode 100644 index 640f52a7d..000000000 --- a/src/api/java/buildcraft/api/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core") -package buildcraft.api; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/power/IEngine.java b/src/api/java/buildcraft/api/power/IEngine.java deleted file mode 100644 index 18901747e..000000000 --- a/src/api/java/buildcraft/api/power/IEngine.java +++ /dev/null @@ -1,26 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.power; - -import net.minecraft.util.EnumFacing; - -/** Engines should implement this interface if they want to support BuildCraft's behaviour of passing energy between - * engines without using receiveEnergy() (which has other issues). */ -public interface IEngine { - /** Returns true if the engine wants to receive power from another engine on this side. - * - * @param side - * @return */ - boolean canReceiveFromEngine(EnumFacing side); - - /** Receives energy from an engine. See - * {@link cofh.api.energy.IEnergyHandler#receiveEnergy(EnumFacing, int, boolean)} - * - * @param side The side the engine is receiving energy from. - * @param energy The amount of energy given to the engine. - * @param simulate True if the energy should not actually be added. - * @return The amount of energy used by the engine. */ - int receiveEnergyFromEngine(EnumFacing side, int energy, boolean simulate); -} diff --git a/src/api/java/buildcraft/api/power/ILaserTarget.java b/src/api/java/buildcraft/api/power/ILaserTarget.java deleted file mode 100644 index 0b3909935..000000000 --- a/src/api/java/buildcraft/api/power/ILaserTarget.java +++ /dev/null @@ -1,28 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.power; - -import net.minecraft.util.BlockPos; - -/** This interface should be defined by any Tile which wants to receive energy from BuildCraft lasers. - * - * The respective Block MUST implement ILaserTargetBlock! */ -public interface ILaserTarget { - - /** Returns true if the target currently needs power. For example, if the Advanced Crafting Table has work to do. - * - * @return true if needs power */ - boolean requiresLaserEnergy(); - - /** Transfers energy from the laser to the target. - * - * @param energy */ - void receiveLaserEnergy(int energy); - - /** Return true if the Tile Entity object is no longer a valid target. For example, if its been invalidated. - * - * @return true if no longer a valid target object */ - boolean isInvalidTarget(); -} diff --git a/src/api/java/buildcraft/api/power/ILaserTargetBlock.java b/src/api/java/buildcraft/api/power/ILaserTargetBlock.java deleted file mode 100644 index 27469605c..000000000 --- a/src/api/java/buildcraft/api/power/ILaserTargetBlock.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.power; - -/** This is a marker interface for laser targets. Implement it on your Block. - * - * It is used by BuildCraft Lasers for optimization purposes. */ -public interface ILaserTargetBlock { - -} diff --git a/src/api/java/buildcraft/api/power/IRedstoneEngine.java b/src/api/java/buildcraft/api/power/IRedstoneEngine.java deleted file mode 100644 index 3fc534d45..000000000 --- a/src/api/java/buildcraft/api/power/IRedstoneEngine.java +++ /dev/null @@ -1,7 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.power; - -public interface IRedstoneEngine {} diff --git a/src/api/java/buildcraft/api/power/IRedstoneEngineReceiver.java b/src/api/java/buildcraft/api/power/IRedstoneEngineReceiver.java deleted file mode 100644 index 213d06fe2..000000000 --- a/src/api/java/buildcraft/api/power/IRedstoneEngineReceiver.java +++ /dev/null @@ -1,21 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.power; - -import net.minecraft.util.EnumFacing; - -import cofh.api.energy.IEnergyReceiver; - -/** Implement this on tiles that you wish to be able to receive Redstone Engine (low-power) energy. - * - * Please do not implement it on batteries, pipes or machines which can have their energy extracted from. That could - * lead to exploits and abuse. */ -public interface IRedstoneEngineReceiver extends IEnergyReceiver { - /** This function is queried on every attempt to receive energy from a redstone engine as well. - * - * @param side - * @return */ - boolean canConnectRedstoneEngine(EnumFacing side); -} diff --git a/src/api/java/buildcraft/api/power/package-info.java b/src/api/java/buildcraft/api/power/package-info.java deleted file mode 100644 index c20c3ee4c..000000000 --- a/src/api/java/buildcraft/api/power/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.3", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|power") -package buildcraft.api.power; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/properties/BuildCraftExtendedProperty.java b/src/api/java/buildcraft/api/properties/BuildCraftExtendedProperty.java deleted file mode 100644 index e0ba3a62d..000000000 --- a/src/api/java/buildcraft/api/properties/BuildCraftExtendedProperty.java +++ /dev/null @@ -1,65 +0,0 @@ -package buildcraft.api.properties; - -import java.util.List; - -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; - -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.common.property.IUnlistedProperty; - -public class BuildCraftExtendedProperty> extends BuildCraftProperty implements IUnlistedProperty { - private final Predicate function; - - public BuildCraftExtendedProperty(String name, Class clazz, Predicate allowingFunction) { - super(name, clazz); - function = allowingFunction; - } - - public BuildCraftExtendedProperty(String name, Class clazz, List allowedValues) { - super(name, clazz, allowedValues); - function = null; - } - - public static BuildCraftExtendedProperty create(String name, final double min, final double max) { - return new BuildCraftExtendedProperty(name, Double.class, new Predicate() { - @Override - public boolean apply(Double input) { - return input >= min && input <= max; - } - }); - } - - /** This is useful if you want to use a particular class for this property, but don't care what the class contains - * (it will never contain an incorrect value) */ - public static > BuildCraftExtendedProperty createExtended(String name, Class clazz) { - return new BuildCraftExtendedProperty(name, clazz, Predicates. alwaysTrue()); - } - - @Override - public boolean isValid(T value) { - if (function == null) { - return values.contains(value); - } - return function.apply(value); - } - - @Override - public Class getType() { - return getValueClass(); - } - - @Override - public String valueToString(T value) { - return valueName(value); - } - - public T getUnlistedValue(IExtendedBlockState state) { - return state.getValue(asUnlistedProperty()); - } - - // Helper methods for arguments - public IUnlistedProperty asUnlistedProperty() { - return this; - } -} diff --git a/src/api/java/buildcraft/api/properties/BuildCraftProperties.java b/src/api/java/buildcraft/api/properties/BuildCraftProperties.java deleted file mode 100644 index 747dd470a..000000000 --- a/src/api/java/buildcraft/api/properties/BuildCraftProperties.java +++ /dev/null @@ -1,83 +0,0 @@ -package buildcraft.api.properties; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.EnumColor; -import buildcraft.api.enums.*; - -public final class BuildCraftProperties { - public static final BuildCraftProperty BLOCK_FACING = BuildCraftProperty.create("facing", EnumFacing.Plane.HORIZONTAL.facings()); - public static final BuildCraftProperty BLOCK_FACING_6 = BuildCraftProperty.create("facing", EnumFacing.class); - - public static final BuildCraftProperty BLOCK_COLOR = BuildCraftProperty.create("color", EnumColor.class); - public static final BuildCraftProperty SPRING_TYPE = BuildCraftProperty.create("type", EnumSpring.class); - public static final BuildCraftProperty ENGINE_TYPE = BuildCraftProperty.create("type", EnumEngineType.class); - public static final BuildCraftProperty LASER_TABLE_TYPE = BuildCraftProperty.create("type", EnumLaserTableType.class); - public static final BuildCraftProperty MACHINE_STATE = BuildCraftProperty.create("state", EnumMachineState.class); - public static final BuildCraftProperty ENERGY_STAGE = BuildCraftProperty.create("stage", EnumEnergyStage.class); - public static final BuildCraftProperty BLUEPRINT_TYPE = BuildCraftProperty.create("blueprint_type", EnumBlueprintType.class); - public static final BuildCraftProperty DECORATED_BLOCK = BuildCraftProperty.create("decoration_type", - EnumDecoratedBlock.class); - - public static final BuildCraftProperty GENERIC_PIPE_DATA = BuildCraftProperty.create("pipe_data", 0, 15); - public static final BuildCraftProperty LED_POWER = BuildCraftProperty.create("led_power", 0, 3); - - public static final BuildCraftProperty JOINED_BELOW = BuildCraftProperty.create("joined_below", false); - public static final BuildCraftProperty MOVING = BuildCraftProperty.create("moving", false); - public static final BuildCraftProperty LED_DONE = BuildCraftProperty.create("led_done", false); - - public static final BuildCraftProperty CONNECTED_UP = BuildCraftProperty.create("connected_up", false); - public static final BuildCraftProperty CONNECTED_DOWN = BuildCraftProperty.create("connected_down", false); - public static final BuildCraftProperty CONNECTED_EAST = BuildCraftProperty.create("connected_east", false); - public static final BuildCraftProperty CONNECTED_WEST = BuildCraftProperty.create("connected_west", false); - public static final BuildCraftProperty CONNECTED_NORTH = BuildCraftProperty.create("connected_north", false); - public static final BuildCraftProperty CONNECTED_SOUTH = BuildCraftProperty.create("connected_south", false); - - public static final Map> CONNECTED_MAP; - - // Unlisted properties - // public static final PropertyDouble FLUID_HEIGHT_NE = new PropertyDouble("height_ne", 0, 1); - // public static final PropertyDouble FLUID_HEIGHT_NW = new PropertyDouble("height_nw", 0, 1); - // public static final PropertyDouble FLUID_HEIGHT_SE = new PropertyDouble("height_se", 0, 1); - // public static final PropertyDouble FLUID_HEIGHT_SW = new PropertyDouble("height_sw", 0, 1); - // public static final PropertyDouble FLUID_FLOW_DIRECTION = new PropertyDouble("direction", - // Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); - public static final BuildCraftProperty FILLER_PATTERN = BuildCraftProperty.create("pattern", EnumFillerPattern.class); - - // Block state setting flags -these are used by World.markAndNotifyBlock and World.setBlockState. These flags can be - // added together to pass the additions - public static final int UPDATE_NONE = 0; - /** This updates the neighbouring blocks that the new block is set. It also updates the comparator output of this - * block. */ - public static final int UPDATE_NEIGHBOURS = 1; - /** This will mark the block for an update next tick, as well as send an update to the client (if this is a server - * world). */ - public static final int MARK_BLOCK_FOR_UPDATE = 2; - /** This will mark the block for an update, even if this is a client world. It is useless to use this if - * world.isRemote returns false. */ - public static final int UPDATE_EVEN_CLIENT = 4 + MARK_BLOCK_FOR_UPDATE; // 6 - - // Pre-added flags- pass these as-is to the World.markAndNotifyBlock and World.setBlockState methods. - /** This will do what both {@link #UPDATE_NEIGHBOURS} and {@link #MARK_BLOCK_FOR_UPDATE} do. */ - public static final int MARK_THIS_AND_NEIGHBOURS = UPDATE_NEIGHBOURS + MARK_BLOCK_FOR_UPDATE; - /** This will update everything about this block. */ - public static final int UPDATE_ALL = UPDATE_NEIGHBOURS + MARK_BLOCK_FOR_UPDATE + UPDATE_EVEN_CLIENT; - - static { - Map> map = Maps.newEnumMap(EnumFacing.class); - map.put(EnumFacing.DOWN, CONNECTED_DOWN); - map.put(EnumFacing.UP, CONNECTED_UP); - map.put(EnumFacing.EAST, CONNECTED_EAST); - map.put(EnumFacing.WEST, CONNECTED_WEST); - map.put(EnumFacing.NORTH, CONNECTED_NORTH); - map.put(EnumFacing.SOUTH, CONNECTED_SOUTH); - CONNECTED_MAP = Maps.immutableEnumMap(map); - } - - /** Deactivate constructor */ - private BuildCraftProperties() {} -} diff --git a/src/api/java/buildcraft/api/properties/BuildCraftProperty.java b/src/api/java/buildcraft/api/properties/BuildCraftProperty.java deleted file mode 100644 index 2a335f9e0..000000000 --- a/src/api/java/buildcraft/api/properties/BuildCraftProperty.java +++ /dev/null @@ -1,129 +0,0 @@ -package buildcraft.api.properties; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import net.minecraft.block.properties.PropertyHelper; -import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MathHelper; - -/** This class exists primarily to allow for a property to be used as either a normal IProperty, or an - * IUnlistedProperty. It also exists to give IProperty's generic types. */ -public class BuildCraftProperty> extends PropertyHelper { - private final String name; - private final Class clazz; - protected final List values; - - public BuildCraftProperty(String name, Class clazz, T[] values) { - this(name, clazz, Arrays.asList(values)); - } - - public BuildCraftProperty(String name, Class clazz, List values) { - super(name, clazz); - this.name = name; - this.clazz = clazz; - this.values = values; - } - - /** Used for BuildCraftInifiniteProperty */ - protected BuildCraftProperty(String name, Class clazz) { - super(name, clazz); - this.name = name; - this.clazz = clazz; - this.values = Collections.emptyList(); - } - - public static > BuildCraftProperty create(String name, Class enumeration) { - List values = Arrays.asList(enumeration.getEnumConstants()); - return new BuildCraftProperty(name, enumeration, values); - } - - public static > BuildCraftProperty create(String name, E... values) { - Class clazz = values[0].getDeclaringClass(); - List list = Arrays.asList(values); - return new BuildCraftProperty(name, clazz, list); - } - - public static BuildCraftProperty create(String name, boolean first) { - return new BuildCraftProperty(name, Boolean.class, new Boolean[] { first, !first }); - } - - /** first and last are both inclusive values (use 0, 4 to create an array of [0, 1, 2, 3, 4]) */ - public static BuildCraftProperty create(String name, int first, int last) { - return create(name, first, last, 1); - } - - /** first and last are both inclusive values (use 0, 12, 3 to create an array of [0, 3, 6, 9, 12]) */ - public static BuildCraftProperty create(String name, int first, int last, int difference) { - int actualDiff = Math.abs(difference); - int number = MathHelper.floor_float(Math.abs(first - last) / (float) actualDiff + 1); - Integer[] array = new Integer[number]; - int addedDiff = actualDiff * (first > last ? -1 : 1); - int current = first; - for (int i = 0; i < array.length; i++) { - array[i] = current; - current += addedDiff; - } - return new BuildCraftProperty(name, Integer.class, array); - } - - public static BuildCraftProperty create(String name, double first, double last) { - return create(name, first, last, 1); - } - - public static BuildCraftProperty create(String name, double first, double last, double difference) { - double actualDiff = Math.abs(difference); - Double[] array = new Double[(int) (Math.abs(first - last) / actualDiff)]; - double addedDiff = actualDiff * (first > last ? -1 : 1); - for (int i = 0; i <= array.length; i++) { - array[i] = first + (first - last) / addedDiff * i; - } - return new BuildCraftProperty(name, Double.class, array); - } - - @Override - public String getName() { - return name; - } - - @Override - public List getAllowedValues() { - return values; - } - - @Override - public Class getValueClass() { - return clazz; - } - - @Override - public String getName(@SuppressWarnings("rawtypes") Comparable value) { - return valueName(value); - } - - protected String valueName(Object value) { - if (value == null) { - return "null"; - } else if (value instanceof IStringSerializable) { - return ((IStringSerializable) value).getName(); - } else if (value instanceof Enum) { - return ((Enum) value).name(); - } else { - return value.toString(); - } - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("BuildCraftProperty [name="); - builder.append(name); - builder.append(", clazz="); - builder.append(clazz); - builder.append(", values="); - builder.append(values); - builder.append("]"); - return builder.toString(); - } -} diff --git a/src/api/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java b/src/api/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java deleted file mode 100644 index 72904b5cb..000000000 --- a/src/api/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java +++ /dev/null @@ -1,16 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -public final class BuildcraftRecipeRegistry { - - public static IAssemblyRecipeManager assemblyTable; - public static IIntegrationRecipeManager integrationTable; - public static IRefineryRecipeManager refinery; - public static IProgrammingRecipeManager programmingTable; - public static IComplexRefineryRecipeManager complexRefinery; - - private BuildcraftRecipeRegistry() {} -} diff --git a/src/api/java/buildcraft/api/recipes/CraftingResult.java b/src/api/java/buildcraft/api/recipes/CraftingResult.java deleted file mode 100644 index 514284423..000000000 --- a/src/api/java/buildcraft/api/recipes/CraftingResult.java +++ /dev/null @@ -1,20 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.ArrayList; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public class CraftingResult { - - public T crafted = null; - public ArrayList usedItems = new ArrayList(); - public ArrayList usedFluids = new ArrayList(); - public int energyCost = 0; - public long craftingTime = 0; - public IFlexibleRecipe recipe; -} diff --git a/src/api/java/buildcraft/api/recipes/IAssemblyRecipeManager.java b/src/api/java/buildcraft/api/recipes/IAssemblyRecipeManager.java deleted file mode 100644 index b9f29ca18..000000000 --- a/src/api/java/buildcraft/api/recipes/IAssemblyRecipeManager.java +++ /dev/null @@ -1,27 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.Collection; - -import net.minecraft.item.ItemStack; - -public interface IAssemblyRecipeManager { - - /** Add an Assembly Table recipe. - * - * @param input Object... containing either an ItemStack, or a paired string and integer(ex: "dyeBlue", 1) - * @param energyCost RF cost to produce - * @param output resulting ItemStack */ - void addRecipe(String id, int energyCost, ItemStack output, Object... input); - - void addRecipe(IFlexibleRecipe recipe); - - void removeRecipe(String id); - - void removeRecipe(IFlexibleRecipe recipe); - - Collection> getRecipes(); -} diff --git a/src/api/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java b/src/api/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java deleted file mode 100644 index 5623b5eaa..000000000 --- a/src/api/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java +++ /dev/null @@ -1,66 +0,0 @@ -package buildcraft.api.recipes; - -import java.util.Set; - -import com.google.common.base.Predicate; - -import net.minecraftforge.fluids.FluidStack; - -public interface IComplexRefineryRecipeManager { - IHeatableRecipe createHeatingRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks); - - IHeatableRecipe addHeatableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks, boolean replaceExisting); - - ICoolableRecipe createCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks); - - ICoolableRecipe addCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks, boolean replaceExisting); - - IDistilationRecipe createDistilationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, int ticks); - - IDistilationRecipe addDistilationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, int ticks, boolean replaceExisting); - - IComplexRefineryRegistry getHeatableRegistry(); - - IComplexRefineryRegistry getCoolableRegistry(); - - IComplexRefineryRegistry getDistilationRegistry(); - - public interface IComplexRefineryRegistry { - /** @return an unmodifiable set containing all of the distilation recipies that satisfy the given predicate. All - * of the recipe objects are guarenteed to never be null. */ - Set getRecipes(Predicate toReturn); - - /** @return an unmodifiable set containing all of the distilation recipies. */ - Set getAllRecipes(); - - R getRecipeForInput(FluidStack fluid); - - Set removeRecipes(Predicate toRemove); - - R addRecipe(R recipe, boolean replaceExisting); - } - - public interface IComplexRefineryRecipe { - int ticks(); - - FluidStack in(); - } - - public interface IHeatExchangerRecipe extends IComplexRefineryRecipe { - FluidStack out(); - - int heatFrom(); - - int heatTo(); - } - - public interface IHeatableRecipe extends IHeatExchangerRecipe {} - - public interface ICoolableRecipe extends IHeatExchangerRecipe {} - - public interface IDistilationRecipe extends IComplexRefineryRecipe { - FluidStack outGas(); - - FluidStack outLiquid(); - } -} diff --git a/src/api/java/buildcraft/api/recipes/IFlexibleCrafter.java b/src/api/java/buildcraft/api/recipes/IFlexibleCrafter.java deleted file mode 100644 index a69b0424f..000000000 --- a/src/api/java/buildcraft/api/recipes/IFlexibleCrafter.java +++ /dev/null @@ -1,24 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public interface IFlexibleCrafter { - - int getCraftingItemStackSize(); - - ItemStack getCraftingItemStack(int slotid); - - ItemStack decrCraftingItemStack(int slotid, int val); - - FluidStack getCraftingFluidStack(int tankid); - - FluidStack decrCraftingFluidStack(int tankid, int val); - - int getCraftingFluidStackSize(); - -} diff --git a/src/api/java/buildcraft/api/recipes/IFlexibleRecipe.java b/src/api/java/buildcraft/api/recipes/IFlexibleRecipe.java deleted file mode 100644 index 53565499d..000000000 --- a/src/api/java/buildcraft/api/recipes/IFlexibleRecipe.java +++ /dev/null @@ -1,18 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import net.minecraft.item.ItemStack; - -public interface IFlexibleRecipe { - - boolean canBeCrafted(IFlexibleCrafter crafter); - - CraftingResult craft(IFlexibleCrafter crafter, boolean preview); - - CraftingResult canCraft(ItemStack expectedOutput); - - String getId(); -} diff --git a/src/api/java/buildcraft/api/recipes/IFlexibleRecipeViewable.java b/src/api/java/buildcraft/api/recipes/IFlexibleRecipeViewable.java deleted file mode 100644 index d19170fa0..000000000 --- a/src/api/java/buildcraft/api/recipes/IFlexibleRecipeViewable.java +++ /dev/null @@ -1,25 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.Collection; - -/** This class is intended for mods such as Not Enough Items in order for them to be able to look inside a recipe. - * - * It is intentionally left as a separate interface, so that it remains possible to register a "dynamic" flexible recipe - * which does not have static inputs and outputs. - * - * @author asie */ -public interface IFlexibleRecipeViewable { - Object getOutput(); - - /** With BuildCraft's implementation (as of 6.1.3), this might contain either an ItemStack, a List<ItemStack> - * or a FluidStack. */ - Collection getInputs(); - - long getCraftingTime(); - - int getEnergyCost(); -} diff --git a/src/api/java/buildcraft/api/recipes/IIntegrationRecipe.java b/src/api/java/buildcraft/api/recipes/IIntegrationRecipe.java deleted file mode 100644 index 8aeb25ade..000000000 --- a/src/api/java/buildcraft/api/recipes/IIntegrationRecipe.java +++ /dev/null @@ -1,59 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -public interface IIntegrationRecipe { - /** Get the energy cost (in RF) of the recipe. - * - * @return The energy cost of the recipe. */ - int getEnergyCost(); - - /** Get a list of example inputs. This is used for recipe preview. - * - * @return A list of example inputs. */ - List getExampleInput(); - - /** Get a list of example expansions. This is used for recipe preview. If the amount of lists of expansions is - * smaller than the maximum expansion count, the lists will be repeated. - * - * @return A list of every slot's list of example expansions. */ - List> getExampleExpansions(); - - /** Get a list of example outputs. This is used for recipe preview. - * - * @return A list of example outputs. */ - List getExampleOutput(); - - /** Check if an input is valid. - * - * @param input The input. - * @return Whether the input is valid. */ - boolean isValidInput(ItemStack input); - - /** Check if an expansion is valid. - * - * @param input The input currently in. - * @param expansion The expansion. - * @return Whether the expansion can be fitted to a given input. */ - boolean isValidExpansion(ItemStack input, ItemStack expansion); - - /** Craft the recipe. Keep in mind that you need to decrease the amount of expansions yourself - the amount of - * inputs is decreased for you. - * - * @param input The input. - * @param expansions All inserted expansions. - * @param preview If true, do not decrease the amount of expansions. - * @return The output stack. */ - ItemStack craft(ItemStack input, List expansions, boolean preview); - - /** Returns the maximum count of expansions this recipe can have. - * - * @return -1 for no limit, a different number otherwise */ - int getMaximumExpansionCount(ItemStack input); -} diff --git a/src/api/java/buildcraft/api/recipes/IIntegrationRecipeManager.java b/src/api/java/buildcraft/api/recipes/IIntegrationRecipeManager.java deleted file mode 100644 index 7bf51e456..000000000 --- a/src/api/java/buildcraft/api/recipes/IIntegrationRecipeManager.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.List; - -public interface IIntegrationRecipeManager { - void addRecipe(IIntegrationRecipe recipe); - - List getRecipes(); -} diff --git a/src/api/java/buildcraft/api/recipes/IProgrammingRecipe.java b/src/api/java/buildcraft/api/recipes/IProgrammingRecipe.java deleted file mode 100644 index 3141196fb..000000000 --- a/src/api/java/buildcraft/api/recipes/IProgrammingRecipe.java +++ /dev/null @@ -1,33 +0,0 @@ -package buildcraft.api.recipes; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -public interface IProgrammingRecipe { - String getId(); - - /** Get a list (size at least width*height) of ItemStacks representing options. - * - * @param width The width of the Programming Table panel. - * @param height The height of the Programming Table panel. - * @return */ - List getOptions(int width, int height); - - /** Get the energy cost of a given option ItemStack. - * - * @param option - * @return */ - int getEnergyCost(ItemStack option); - - /** @param input The input stack. - * @return Whether this recipe applies to the given input stack. */ - boolean canCraft(ItemStack input); - - /** Craft the input ItemStack with the given option into an output ItemStack. - * - * @param input - * @param option - * @return The output ItemStack. */ - ItemStack craft(ItemStack input, ItemStack option); -} diff --git a/src/api/java/buildcraft/api/recipes/IProgrammingRecipeManager.java b/src/api/java/buildcraft/api/recipes/IProgrammingRecipeManager.java deleted file mode 100644 index 1ea444631..000000000 --- a/src/api/java/buildcraft/api/recipes/IProgrammingRecipeManager.java +++ /dev/null @@ -1,19 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.Collection; - -public interface IProgrammingRecipeManager { - void addRecipe(IProgrammingRecipe recipe); - - void removeRecipe(String id); - - void removeRecipe(IProgrammingRecipe recipe); - - IProgrammingRecipe getRecipe(String id); - - Collection getRecipes(); -} diff --git a/src/api/java/buildcraft/api/recipes/IRecipeManager.java b/src/api/java/buildcraft/api/recipes/IRecipeManager.java deleted file mode 100644 index fa767734a..000000000 --- a/src/api/java/buildcraft/api/recipes/IRecipeManager.java +++ /dev/null @@ -1,29 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.Collection; - -public interface IRecipeManager { - - /** Add a recipe. - * - * @param input Object... containing either an ItemStack, or a paired string and integer(ex: "dyeBlue", 1) - * @param energyCost RF cost to produce - * @param output resulting ItemStack */ - void addRecipe(String id, int energyCost, T output, Object... input); - - void addRecipe(String id, int energyCost, int craftingDelay, T output, Object... input); - - void addRecipe(IFlexibleRecipe recipe); - - void removeRecipe(String id); - - void removeRecipe(IFlexibleRecipe recipe); - - Collection> getRecipes(); - - IFlexibleRecipe getRecipe(String id); -} diff --git a/src/api/java/buildcraft/api/recipes/IRefineryRecipeManager.java b/src/api/java/buildcraft/api/recipes/IRefineryRecipeManager.java deleted file mode 100644 index b310fe236..000000000 --- a/src/api/java/buildcraft/api/recipes/IRefineryRecipeManager.java +++ /dev/null @@ -1,25 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.Collection; - -import net.minecraftforge.fluids.FluidStack; - -public interface IRefineryRecipeManager { - - void addRecipe(String id, FluidStack ingredient, FluidStack result, int energy, int delay); - - void addRecipe(String id, FluidStack ingredient1, FluidStack ingredient2, FluidStack result, int energy, int delay); - - void removeRecipe(String id); - - void removeRecipe(IFlexibleRecipe recipe); - - Collection> getRecipes(); - - IFlexibleRecipe getRecipe(String currentRecipeId); - -} diff --git a/src/api/java/buildcraft/api/recipes/package-info.java b/src/api/java/buildcraft/api/recipes/package-info.java deleted file mode 100644 index f8cc9942a..000000000 --- a/src/api/java/buildcraft/api/recipes/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "3.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|recipes") -package buildcraft.api.recipes; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/robots/AIRobot.java b/src/api/java/buildcraft/api/robots/AIRobot.java deleted file mode 100644 index 8c401d960..000000000 --- a/src/api/java/buildcraft/api/robots/AIRobot.java +++ /dev/null @@ -1,220 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.robots; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public class AIRobot { - public EntityRobotBase robot; - - private AIRobot delegateAI; - private AIRobot parentAI; - - private boolean success; - - public AIRobot(EntityRobotBase iRobot) { - robot = iRobot; - success = true; - } - - public void start() { - - } - - public void preempt(AIRobot ai) { - - } - - public void update() { - // Update should always handle terminate. Some AI are not using update - // at all, their code being in start() and end(). In these case, - // calling update is a malfunction, the ai should be terminated. - terminate(); - } - - public void end() { - - } - - /** This gets called when a delegate AI ends work naturally. - * - * @param ai The delegate AI which ended work. */ - public void delegateAIEnded(AIRobot ai) { - - } - - /** This gets called when a delegate AI is forcibly aborted. - * - * @param ai The delegate AI which was aborted. */ - public void delegateAIAborted(AIRobot ai) { - - } - - public void writeSelfToNBT(NBTTagCompound nbt) { - - } - - public void loadSelfFromNBT(NBTTagCompound nbt) { - - } - - public boolean success() { - return success; - } - - protected void setSuccess(boolean iSuccess) { - success = iSuccess; - } - - public int getEnergyCost() { - return 1; - } - - public boolean canLoadFromNBT() { - return false; - } - - /** Tries to receive items in parameters, return items that are left after the operation. */ - public ItemStack receiveItem(ItemStack stack) { - return stack; - } - - public final void terminate() { - abortDelegateAI(); - end(); - - if (parentAI != null) { - parentAI.delegateAI = null; - parentAI.delegateAIEnded(this); - } - } - - public final void abort() { - abortDelegateAI(); - - try { - end(); - - if (parentAI != null) { - parentAI.delegateAI = null; - parentAI.delegateAIAborted(this); - } - } catch (Throwable e) { - e.printStackTrace(); - delegateAI = null; - - if (parentAI != null) { - parentAI.delegateAI = null; - } - } - } - - public final void cycle() { - try { - preempt(delegateAI); - - if (delegateAI != null) { - delegateAI.cycle(); - } else { - robot.getBattery().extractEnergy(getEnergyCost(), false); - update(); - } - } catch (Throwable e) { - e.printStackTrace(); - abort(); - } - } - - public final void startDelegateAI(AIRobot ai) { - abortDelegateAI(); - delegateAI = ai; - ai.parentAI = this; - delegateAI.start(); - } - - public final void abortDelegateAI() { - if (delegateAI != null) { - delegateAI.abort(); - } - } - - public final AIRobot getActiveAI() { - if (delegateAI != null) { - return delegateAI.getActiveAI(); - } else { - return this; - } - } - - public final AIRobot getDelegateAI() { - return delegateAI; - } - - public final void writeToNBT(NBTTagCompound nbt) { - nbt.setString("aiName", RobotManager.getAIRobotName(getClass())); - - NBTTagCompound data = new NBTTagCompound(); - writeSelfToNBT(data); - nbt.setTag("data", data); - - if (delegateAI != null && delegateAI.canLoadFromNBT()) { - NBTTagCompound sub = new NBTTagCompound(); - - delegateAI.writeToNBT(sub); - nbt.setTag("delegateAI", sub); - } - } - - public final void loadFromNBT(NBTTagCompound nbt) { - loadSelfFromNBT(nbt.getCompoundTag("data")); - - if (nbt.hasKey("delegateAI")) { - NBTTagCompound sub = nbt.getCompoundTag("delegateAI"); - - try { - Class aiRobotClass; - if (sub.hasKey("class")) { - // Migration support for 6.4.x - aiRobotClass = RobotManager.getAIRobotByLegacyClassName(sub.getString("class")); - } else { - aiRobotClass = RobotManager.getAIRobotByName(sub.getString("aiName")); - } - if (aiRobotClass != null) { - delegateAI = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class).newInstance(robot); - delegateAI.parentAI = this; - - if (delegateAI.canLoadFromNBT()) { - delegateAI.loadFromNBT(sub); - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - } - - public static AIRobot loadAI(NBTTagCompound nbt, EntityRobotBase robot) { - AIRobot ai = null; - - try { - Class aiRobotClass; - if (nbt.hasKey("class")) { - // Migration support for 6.4.x - aiRobotClass = RobotManager.getAIRobotByLegacyClassName(nbt.getString("class")); - } else { - aiRobotClass = RobotManager.getAIRobotByName(nbt.getString("aiName")); - } - if (aiRobotClass != null) { - ai = (AIRobot) aiRobotClass.getConstructor(EntityRobotBase.class).newInstance(robot); - ai.loadFromNBT(nbt); - } - } catch (Throwable e) { - e.printStackTrace(); - } - - return ai; - } -} diff --git a/src/api/java/buildcraft/api/robots/DockingStation.java b/src/api/java/buildcraft/api/robots/DockingStation.java deleted file mode 100644 index 8417a86e5..000000000 --- a/src/api/java/buildcraft/api/robots/DockingStation.java +++ /dev/null @@ -1,225 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.robots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -import net.minecraftforge.fluids.IFluidHandler; - -import buildcraft.api.core.BCLog; -import buildcraft.api.core.EnumPipePart; -import buildcraft.api.statements.StatementSlot; -import buildcraft.api.transport.IInjectable; - -public abstract class DockingStation { - public EnumFacing side; - public World world; - - private long robotTakingId = EntityRobotBase.NULL_ROBOT_ID; - private EntityRobotBase robotTaking; - - private boolean linkIsMain = false; - - private BlockPos pos; - - public DockingStation(BlockPos iIndex, EnumFacing iSide) { - pos = iIndex; - side = iSide; - } - - public DockingStation() {} - - public boolean isMainStation() { - return linkIsMain; - } - - public BlockPos getPos() { - return pos; - } - - public EnumFacing side() { - return side; - } - - public EntityRobotBase robotTaking() { - if (robotTakingId == EntityRobotBase.NULL_ROBOT_ID) { - return null; - } else if (robotTaking == null) { - robotTaking = RobotManager.registryProvider.getRegistry(world).getLoadedRobot(robotTakingId); - } - - return robotTaking; - } - - public void invalidateRobotTakingEntity() { - robotTaking = null; - } - - public long linkedId() { - return robotTakingId; - } - - public boolean takeAsMain(EntityRobotBase robot) { - if (robotTakingId == EntityRobotBase.NULL_ROBOT_ID) { - IRobotRegistry registry = RobotManager.registryProvider.getRegistry(world); - linkIsMain = true; - robotTaking = robot; - robotTakingId = robot.getRobotId(); - registry.registryMarkDirty(); - robot.setMainStation(this); - registry.take(this, robot.getRobotId()); - - return true; - } else { - return robotTakingId == robot.getRobotId(); - } - } - - public boolean take(EntityRobotBase robot) { - if (robotTaking == null) { - IRobotRegistry registry = RobotManager.registryProvider.getRegistry(world); - linkIsMain = false; - robotTaking = robot; - robotTakingId = robot.getRobotId(); - registry.registryMarkDirty(); - registry.take(this, robot.getRobotId()); - - return true; - } else { - return robot.getRobotId() == robotTakingId; - } - } - - public void release(EntityRobotBase robot) { - if (robotTaking == robot && !linkIsMain) { - IRobotRegistry registry = RobotManager.registryProvider.getRegistry(world); - unsafeRelease(robot); - registry.registryMarkDirty(); - registry.release(this, robot.getRobotId()); - } - } - - /** Same a release but doesn't clear the registry (presumably called from the registry). */ - public void unsafeRelease(EntityRobotBase robot) { - if (robotTaking == robot) { - linkIsMain = false; - robotTaking = null; - robotTakingId = EntityRobotBase.NULL_ROBOT_ID; - } - } - - public void writeToNBT(NBTTagCompound nbt) { - nbt.setIntArray("pos", new int[] { getPos().getX(), getPos().getY(), getPos().getZ() }); - nbt.setByte("side", (byte) side.ordinal()); - nbt.setBoolean("isMain", linkIsMain); - nbt.setLong("robotId", robotTakingId); - } - - public void readFromNBT(NBTTagCompound nbt) { - if (nbt.hasKey("index")) { - // For compatibility with older versions of minecraft and buildcraft - NBTTagCompound indexNBT = nbt.getCompoundTag("index"); - int x = indexNBT.getInteger("i"); - int y = indexNBT.getInteger("j"); - int z = indexNBT.getInteger("k"); - pos = new BlockPos(x, y, z); - } else { - int[] array = nbt.getIntArray("pos"); - if (array.length == 3) { - pos = new BlockPos(array[0], array[1], array[2]); - } else if (array.length != 0) { - BCLog.logger.warn("Found an integer array that wwas not the right length! (" + array + ")"); - } else { - BCLog.logger.warn("Did not find any integer positions! This is a bug!"); - } - } - side = EnumFacing.values()[nbt.getByte("side")]; - linkIsMain = nbt.getBoolean("isMain"); - robotTakingId = nbt.getLong("robotId"); - } - - public boolean isTaken() { - return robotTakingId != EntityRobotBase.NULL_ROBOT_ID; - } - - public long robotIdTaking() { - return robotTakingId; - } - - public BlockPos index() { - return pos; - } - - @Override - public String toString() { - return "{" + pos + ", " + side + " :" + robotTakingId + "}"; - } - - public boolean linkIsDocked() { - if (robotTaking() != null) { - return robotTaking().getDockingStation() == this; - } else { - return false; - } - } - - public boolean canRelease() { - return !isMainStation() && !linkIsDocked(); - } - - public boolean isInitialized() { - return true; - } - - public abstract Iterable getActiveActions(); - - public IInjectable getItemOutput() { - return null; - } - - public EnumPipePart getItemOutputSide() { - return EnumPipePart.CENTER; - } - - public IInventory getItemInput() { - return null; - } - - public EnumPipePart getItemInputSide() { - return EnumPipePart.CENTER; - } - - public IFluidHandler getFluidOutput() { - return null; - } - - public EnumPipePart getFluidOutputSide() { - return EnumPipePart.CENTER; - } - - public IFluidHandler getFluidInput() { - return null; - } - - public EnumPipePart getFluidInputSide() { - return EnumPipePart.CENTER; - } - - public boolean providesPower() { - return false; - } - - public IRequestProvider getRequestProvider() { - return null; - } - - public void onChunkUnload() { - - } -} diff --git a/src/api/java/buildcraft/api/robots/EntityRobotBase.java b/src/api/java/buildcraft/api/robots/EntityRobotBase.java deleted file mode 100644 index a86842256..000000000 --- a/src/api/java/buildcraft/api/robots/EntityRobotBase.java +++ /dev/null @@ -1,84 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.robots; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.fluids.IFluidHandler; - -import cofh.api.energy.IEnergyStorage; - -import buildcraft.api.boards.RedstoneBoardRobot; -import buildcraft.api.core.IZone; - -public abstract class EntityRobotBase extends EntityLiving implements IInventory, IFluidHandler { - - public static final int MAX_ENERGY = 100000; - public static final int SAFETY_ENERGY = MAX_ENERGY / 5; - public static final int SHUTDOWN_ENERGY = 0; - public static final long NULL_ROBOT_ID = Long.MAX_VALUE; - - public EntityRobotBase(World par1World) { - super(par1World); - } - - public abstract void setItemInUse(ItemStack stack); - - public abstract void setItemActive(boolean b); - - public abstract boolean isMoving(); - - public abstract DockingStation getLinkedStation(); - - public abstract RedstoneBoardRobot getBoard(); - - public abstract void aimItemAt(float yaw, float pitch); - - public abstract void aimItemAt(BlockPos pos); - - public abstract float getAimYaw(); - - public abstract float getAimPitch(); - - public abstract int getEnergy(); - - public abstract IEnergyStorage getBattery(); - - public abstract DockingStation getDockingStation(); - - public abstract void dock(DockingStation station); - - public abstract void undock(); - - public abstract IZone getZoneToWork(); - - public abstract IZone getZoneToLoadUnload(); - - public abstract boolean containsItems(); - - public abstract boolean hasFreeSlot(); - - public abstract void unreachableEntityDetected(Entity entity); - - public abstract boolean isKnownUnreachable(Entity entity); - - public abstract long getRobotId(); - - public abstract IRobotRegistry getRegistry(); - - public abstract void releaseResources(); - - public abstract void onChunkUnload(); - - public abstract ItemStack receiveItem(TileEntity tile, ItemStack stack); - - public abstract void setMainStation(DockingStation station); -} diff --git a/src/api/java/buildcraft/api/robots/IDockingStationProvider.java b/src/api/java/buildcraft/api/robots/IDockingStationProvider.java deleted file mode 100644 index 0cbd3c3b8..000000000 --- a/src/api/java/buildcraft/api/robots/IDockingStationProvider.java +++ /dev/null @@ -1,6 +0,0 @@ -package buildcraft.api.robots; - -/** By default, this can be either an IPipePluggable or a TileEntity. */ -public interface IDockingStationProvider { - DockingStation getStation(); -} diff --git a/src/api/java/buildcraft/api/robots/IRequestProvider.java b/src/api/java/buildcraft/api/robots/IRequestProvider.java deleted file mode 100644 index 2e56148a8..000000000 --- a/src/api/java/buildcraft/api/robots/IRequestProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.robots; - -import net.minecraft.item.ItemStack; - -/** Provide requests of items that need to be fulfilled. - * - * Requests are organized as an linear array, where null entries mark slots without a requests. A request in a slot, or - * the amount of slots, is allowed to change before a call to {@link #offerItem(int, ItemStack)}, but it is not - * recommended that this is frequent, since the request delivery won't fail until it is offered the previous request. */ -public interface IRequestProvider { - /** Return the total number of request slots available from this provider. - * - * @return */ - int getRequestsCount(); - - /** Return a stack with the request in the slot. - * - * @param slot - * @return the request in the slot, or null if there's no request. */ - ItemStack getRequest(int slot); - - /** Fulfill the request in slot with the stack given and return any excess. - * - * @param slot - * @param stack - * @return any excess that was not used to fulfill the request. */ - ItemStack offerItem(int slot, ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/robots/IRobotOverlayItem.java b/src/api/java/buildcraft/api/robots/IRobotOverlayItem.java deleted file mode 100644 index 82e0a39ce..000000000 --- a/src/api/java/buildcraft/api/robots/IRobotOverlayItem.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.robots; - -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IRobotOverlayItem { - boolean isValidRobotOverlay(ItemStack stack); - - @SideOnly(Side.CLIENT) - void renderRobotOverlay(ItemStack stack, TextureManager textureManager); -} diff --git a/src/api/java/buildcraft/api/robots/IRobotRegistry.java b/src/api/java/buildcraft/api/robots/IRobotRegistry.java deleted file mode 100644 index 07b432f6c..000000000 --- a/src/api/java/buildcraft/api/robots/IRobotRegistry.java +++ /dev/null @@ -1,56 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.robots; - -import java.util.Collection; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; - -public interface IRobotRegistry { - - long getNextRobotId(); - - void registerRobot(EntityRobotBase robot); - - void killRobot(EntityRobotBase robot); - - void unloadRobot(EntityRobotBase robot); - - EntityRobotBase getLoadedRobot(long id); - - boolean isTaken(ResourceId resourceId); - - long robotIdTaking(ResourceId resourceId); - - EntityRobotBase robotTaking(ResourceId resourceId); - - boolean take(ResourceId resourceId, EntityRobotBase robot); - - boolean take(ResourceId resourceId, long robotId); - - void release(ResourceId resourceId); - - void releaseResources(EntityRobotBase robot); - - DockingStation getStation(BlockPos pos, EnumFacing side); - - Collection getStations(); - - void registerStation(DockingStation station); - - void removeStation(DockingStation station); - - void take(DockingStation station, long robotId); - - void release(DockingStation station, long robotId); - - void writeToNBT(NBTTagCompound nbt); - - void readFromNBT(NBTTagCompound nbt); - - void registryMarkDirty(); -} diff --git a/src/api/java/buildcraft/api/robots/IRobotRegistryProvider.java b/src/api/java/buildcraft/api/robots/IRobotRegistryProvider.java deleted file mode 100644 index 001249453..000000000 --- a/src/api/java/buildcraft/api/robots/IRobotRegistryProvider.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.robots; - -import net.minecraft.world.World; - -public interface IRobotRegistryProvider { - IRobotRegistry getRegistry(World world); -} diff --git a/src/api/java/buildcraft/api/robots/ResourceId.java b/src/api/java/buildcraft/api/robots/ResourceId.java deleted file mode 100644 index 539503a0f..000000000 --- a/src/api/java/buildcraft/api/robots/ResourceId.java +++ /dev/null @@ -1,39 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.robots; - -import net.minecraft.nbt.NBTTagCompound; - -public abstract class ResourceId { - - protected ResourceId() {} - - public void writeToNBT(NBTTagCompound nbt) { - nbt.setString("resourceName", RobotManager.getResourceIdName(getClass())); - } - - protected void readFromNBT(NBTTagCompound nbt) {} - - public static ResourceId load(NBTTagCompound nbt) { - try { - Class cls; - if (nbt.hasKey("class")) { - // Migration support for 6.4.x - cls = RobotManager.getResourceIdByLegacyClassName(nbt.getString("class")); - } else { - cls = RobotManager.getResourceIdByName(nbt.getString("resourceName")); - } - - ResourceId id = (ResourceId) cls.newInstance(); - id.readFromNBT(nbt); - - return id; - } catch (Throwable e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/src/api/java/buildcraft/api/robots/ResourceIdBlock.java b/src/api/java/buildcraft/api/robots/ResourceIdBlock.java deleted file mode 100644 index 29159a912..000000000 --- a/src/api/java/buildcraft/api/robots/ResourceIdBlock.java +++ /dev/null @@ -1,70 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.robots; - -import org.apache.commons.lang3.builder.HashCodeBuilder; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; - -import buildcraft.api.core.EnumPipePart; - -public class ResourceIdBlock extends ResourceId { - - public BlockPos pos = new BlockPos(0, 0, 0); - public EnumPipePart side = EnumPipePart.CENTER; - - public ResourceIdBlock() { - - } - - public ResourceIdBlock(int x, int y, int z) { - pos = new BlockPos(x, y, z); - } - - public ResourceIdBlock(BlockPos iIndex) { - pos = iIndex; - } - - public ResourceIdBlock(TileEntity tile) { - pos = tile.getPos(); - } - - @Override - public boolean equals(Object obj) { - if (obj == null || obj.getClass() != getClass()) { - return false; - } - - ResourceIdBlock compareId = (ResourceIdBlock) obj; - - return pos.equals(compareId.pos) && side == compareId.side; - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(pos.hashCode()).append(side != null ? side.ordinal() : 0).build(); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); - - int[] arr = new int[] { pos.getX(), pos.getY(), pos.getZ() }; - nbt.setIntArray("pos", arr); - - nbt.setTag("side", side.writeToNBT()); - } - - @Override - protected void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(nbt); - int[] arr = nbt.getIntArray("pos"); - pos = new BlockPos(arr[0], arr[1], arr[2]); - - side = EnumPipePart.readFromNBT(nbt.getTag("side")); - } -} diff --git a/src/api/java/buildcraft/api/robots/ResourceIdRequest.java b/src/api/java/buildcraft/api/robots/ResourceIdRequest.java deleted file mode 100644 index ab37ad2c6..000000000 --- a/src/api/java/buildcraft/api/robots/ResourceIdRequest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.robots; - -import org.apache.commons.lang3.builder.HashCodeBuilder; - -import net.minecraft.nbt.NBTTagCompound; - -import buildcraft.api.core.EnumPipePart; - -public class ResourceIdRequest extends ResourceIdBlock { - - private int slot; - - public ResourceIdRequest() { - - } - - public ResourceIdRequest(DockingStation station, int slot) { - pos = station.index(); - side = EnumPipePart.fromFacing(station.side()); - this.slot = slot; - } - - @Override - public boolean equals(Object obj) { - if (!super.equals(obj)) return false; - ResourceIdRequest compareId = (ResourceIdRequest) obj; - - return slot == compareId.slot; - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(super.hashCode()).append(slot).build(); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); - - nbt.setInteger("localId", slot); - } - - @Override - protected void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(nbt); - - slot = nbt.getInteger("localId"); - } -} diff --git a/src/api/java/buildcraft/api/robots/RobotManager.java b/src/api/java/buildcraft/api/robots/RobotManager.java deleted file mode 100644 index aa59fc4d7..000000000 --- a/src/api/java/buildcraft/api/robots/RobotManager.java +++ /dev/null @@ -1,114 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.robots; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import buildcraft.api.core.BCLog; - -public abstract class RobotManager { - public static IRobotRegistryProvider registryProvider; - public static ArrayList> aiRobots = new ArrayList>(); - - static { - aiRobotsByNames = new HashMap>(); - aiRobotsNames = new HashMap, String>(); - aiRobotsByLegacyClassNames = new HashMap>(); - resourceIdNames = new HashMap, String>(); - resourceIdByNames = new HashMap>(); - resourceIdLegacyClassNames = new HashMap>(); - dockingStationNames = new HashMap, String>(); - dockingStationByNames = new HashMap>(); - - registerResourceId(ResourceIdBlock.class, "resourceIdBlock", "buildcraft.core.robots.ResourceIdBlock"); - registerResourceId(ResourceIdRequest.class, "resourceIdRequest", "buildcraft.core.robots.ResourceIdRequest"); - } - - private static Map, String> aiRobotsNames; - private static Map> aiRobotsByNames; - private static Map> aiRobotsByLegacyClassNames; - - private static Map, String> resourceIdNames; - private static Map> resourceIdByNames; - private static Map> resourceIdLegacyClassNames; - - private static Map, String> dockingStationNames; - private static Map> dockingStationByNames; - - public static void registerAIRobot(Class aiRobot, String name) { - registerAIRobot(aiRobot, name, null); - } - - public static void registerAIRobot(Class aiRobot, String name, String legacyClassName) { - if (aiRobotsByNames.containsKey(name)) { - BCLog.logger.info("Overriding " + aiRobotsByNames.get(name).getName() + " with " + aiRobot.getName()); - } - - // Check if NBT-load constructor is present - try { - aiRobot.getConstructor(EntityRobotBase.class); - } catch (NoSuchMethodException e) { - throw new RuntimeException("AI class " + aiRobot.getName() + " lacks NBT load construtor! This is a bug!"); - } - - aiRobots.add(aiRobot); - aiRobotsByNames.put(name, aiRobot); - aiRobotsNames.put(aiRobot, name); - if (legacyClassName != null) { - aiRobotsByLegacyClassNames.put(legacyClassName, aiRobot); - } - } - - public static Class getAIRobotByName(String aiRobotName) { - return aiRobotsByNames.get(aiRobotName); - } - - public static String getAIRobotName(Class aiRobotClass) { - return aiRobotsNames.get(aiRobotClass); - } - - public static Class getAIRobotByLegacyClassName(String aiRobotLegacyClassName) { - return aiRobotsByLegacyClassNames.get(aiRobotLegacyClassName); - } - - public static void registerResourceId(Class resourceId, String name) { - registerResourceId(resourceId, name, null); - } - - public static void registerResourceId(Class resourceId, String name, String legacyClassName) { - resourceIdByNames.put(name, resourceId); - resourceIdNames.put(resourceId, name); - if (legacyClassName != null) { - resourceIdLegacyClassNames.put(legacyClassName, resourceId); - } - } - - public static Class getResourceIdByName(String resourceIdName) { - return resourceIdByNames.get(resourceIdName); - } - - public static String getResourceIdName(Class resouceIdClass) { - return resourceIdNames.get(resouceIdClass); - } - - public static Class getResourceIdByLegacyClassName(String resourceIdLegacyClassName) { - return resourceIdLegacyClassNames.get(resourceIdLegacyClassName); - } - - public static void registerDockingStation(Class dockingStation, String name) { - dockingStationByNames.put(name, dockingStation); - dockingStationNames.put(dockingStation, name); - } - - public static Class getDockingStationByName(String dockingStationTypeName) { - return dockingStationByNames.get(dockingStationTypeName); - } - - public static String getDockingStationName(Class dockingStation) { - return dockingStationNames.get(dockingStation); - } -} diff --git a/src/api/java/buildcraft/api/robots/package-info.java b/src/api/java/buildcraft/api/robots/package-info.java deleted file mode 100644 index 4fd622b34..000000000 --- a/src/api/java/buildcraft/api/robots/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "3.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|robotics") -package buildcraft.api.robots; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/statements/ActionState.java b/src/api/java/buildcraft/api/statements/ActionState.java deleted file mode 100644 index 15f547c07..000000000 --- a/src/api/java/buildcraft/api/statements/ActionState.java +++ /dev/null @@ -1,9 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -public class ActionState { - -} diff --git a/src/api/java/buildcraft/api/statements/IActionExternal.java b/src/api/java/buildcraft/api/statements/IActionExternal.java deleted file mode 100644 index 21ffc92c4..000000000 --- a/src/api/java/buildcraft/api/statements/IActionExternal.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -public interface IActionExternal extends IStatement { - void actionActivate(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); -} diff --git a/src/api/java/buildcraft/api/statements/IActionInternal.java b/src/api/java/buildcraft/api/statements/IActionInternal.java deleted file mode 100644 index 621c317e8..000000000 --- a/src/api/java/buildcraft/api/statements/IActionInternal.java +++ /dev/null @@ -1,15 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -public interface IActionInternal extends IStatement { - - void actionActivate(IStatementContainer source, IStatementParameter[] parameters); - - public interface IActionInternalSingle extends IActionInternal { - /** @return True if this action should only be fired for the first tick of it being active. */ - boolean singleActionTick(); - } -} diff --git a/src/api/java/buildcraft/api/statements/IActionProvider.java b/src/api/java/buildcraft/api/statements/IActionProvider.java deleted file mode 100644 index 63625b05a..000000000 --- a/src/api/java/buildcraft/api/statements/IActionProvider.java +++ /dev/null @@ -1,19 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import java.util.Collection; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -public interface IActionProvider { - - /** Returns the list of actions that are available from the statement container holding the gate. */ - Collection getInternalActions(IStatementContainer container); - - /** Returns the list of actions available to a gate next to the given block. */ - Collection getExternalActions(EnumFacing side, TileEntity tile); -} diff --git a/src/api/java/buildcraft/api/statements/IActionReceptor.java b/src/api/java/buildcraft/api/statements/IActionReceptor.java deleted file mode 100644 index 34155b86a..000000000 --- a/src/api/java/buildcraft/api/statements/IActionReceptor.java +++ /dev/null @@ -1,9 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -public interface IActionReceptor { - void actionActivated(IStatement statement, IStatementParameter[] parameters); -} diff --git a/src/api/java/buildcraft/api/statements/IOverrideDefaultStatements.java b/src/api/java/buildcraft/api/statements/IOverrideDefaultStatements.java deleted file mode 100644 index cb2dc78e1..000000000 --- a/src/api/java/buildcraft/api/statements/IOverrideDefaultStatements.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import java.util.List; - -public interface IOverrideDefaultStatements { - List overrideTriggers(); - - List overrideActions(); -} diff --git a/src/api/java/buildcraft/api/statements/IStatement.java b/src/api/java/buildcraft/api/statements/IStatement.java deleted file mode 100644 index dc0254332..000000000 --- a/src/api/java/buildcraft/api/statements/IStatement.java +++ /dev/null @@ -1,36 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IStatement { - /** Every statement needs a unique tag, it should be in the format of "<modid>:<name>. - * - * @return the unique id */ - String getUniqueTag(); - - /** Return the maximum number of parameter this statement can have, 0 if none. */ - int maxParameters(); - - /** Return the minimum number of parameter this statement can have, 0 if none. */ - int minParameters(); - - /** Return the statement description in the UI */ - String getDescription(); - - /** Create parameters for the statement. */ - IStatementParameter createParameter(int index); - - /** This returns the statement after a left rotation. Used in particular in blueprints orientation. */ - IStatement rotateLeft(); - - /** This should return the icon for this statement, suitable for rending directly into a GUI. This should refer to a - * texture on the map block texture map. */ - @SideOnly(Side.CLIENT) - TextureAtlasSprite getGuiSprite(); -} diff --git a/src/api/java/buildcraft/api/statements/IStatementContainer.java b/src/api/java/buildcraft/api/statements/IStatementContainer.java deleted file mode 100644 index f4a73465f..000000000 --- a/src/api/java/buildcraft/api/statements/IStatementContainer.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import net.minecraft.tileentity.TileEntity; - -/** This is implemented by objects containing Statements, such as Gates and TileEntities. */ -public interface IStatementContainer { - TileEntity getTile(); -} diff --git a/src/api/java/buildcraft/api/statements/IStatementParameter.java b/src/api/java/buildcraft/api/statements/IStatementParameter.java deleted file mode 100644 index 7ef29c793..000000000 --- a/src/api/java/buildcraft/api/statements/IStatementParameter.java +++ /dev/null @@ -1,36 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IStatementParameter { - - /** Every parameter needs a unique tag, it should be in the format of "<modid>:<name>". - * - * @return the unique id */ - String getUniqueTag(); - - @SideOnly(Side.CLIENT) - TextureAtlasSprite getIcon(); - - ItemStack getItemStack(); - - /** Return the parameter description in the UI */ - String getDescription(); - - void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse); - - void readFromNBT(NBTTagCompound compound); - - void writeToNBT(NBTTagCompound compound); - - /** This returns the parameter after a left rotation. Used in particular in blueprints orientation. */ - IStatementParameter rotateLeft(); -} diff --git a/src/api/java/buildcraft/api/statements/ITriggerExternal.java b/src/api/java/buildcraft/api/statements/ITriggerExternal.java deleted file mode 100644 index 3db589cbc..000000000 --- a/src/api/java/buildcraft/api/statements/ITriggerExternal.java +++ /dev/null @@ -1,14 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -public interface ITriggerExternal extends IStatement { - - boolean isTriggerActive(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); - -} diff --git a/src/api/java/buildcraft/api/statements/ITriggerExternalOverride.java b/src/api/java/buildcraft/api/statements/ITriggerExternalOverride.java deleted file mode 100644 index b8628deec..000000000 --- a/src/api/java/buildcraft/api/statements/ITriggerExternalOverride.java +++ /dev/null @@ -1,16 +0,0 @@ -package buildcraft.api.statements; - -import net.minecraft.util.EnumFacing; - -/** This interface can be used by tiles to override external trigger behaviour. - * - * Please use wisely. */ -public interface ITriggerExternalOverride { - public enum Result { - TRUE, - FALSE, - IGNORE - } - - Result override(EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); -} diff --git a/src/api/java/buildcraft/api/statements/ITriggerInternal.java b/src/api/java/buildcraft/api/statements/ITriggerInternal.java deleted file mode 100644 index 610a5728b..000000000 --- a/src/api/java/buildcraft/api/statements/ITriggerInternal.java +++ /dev/null @@ -1,11 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -public interface ITriggerInternal extends IStatement { - - boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters); - -} diff --git a/src/api/java/buildcraft/api/statements/ITriggerProvider.java b/src/api/java/buildcraft/api/statements/ITriggerProvider.java deleted file mode 100644 index d6ffbd42f..000000000 --- a/src/api/java/buildcraft/api/statements/ITriggerProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import java.util.Collection; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -public interface ITriggerProvider { - - /** Returns the list of triggers that are available from the object holding the gate. */ - Collection getInternalTriggers(IStatementContainer container); - - /** Returns the list of triggers available to a gate next to the given block. */ - Collection getExternalTriggers(EnumFacing side, TileEntity tile); - -} diff --git a/src/api/java/buildcraft/api/statements/StatementManager.java b/src/api/java/buildcraft/api/statements/StatementManager.java deleted file mode 100644 index 166541ac1..000000000 --- a/src/api/java/buildcraft/api/statements/StatementManager.java +++ /dev/null @@ -1,181 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.BCLog; - -public final class StatementManager { - - public static Map statements = new HashMap(); - public static Map> parameters = new HashMap>(); - private static List triggerProviders = new LinkedList(); - private static List actionProviders = new LinkedList(); - - /** Deactivate constructor */ - private StatementManager() {} - - public static void registerTriggerProvider(ITriggerProvider provider) { - if (provider != null && !triggerProviders.contains(provider)) { - triggerProviders.add(provider); - } - } - - public static void registerActionProvider(IActionProvider provider) { - if (provider != null && !actionProviders.contains(provider)) { - actionProviders.add(provider); - } - } - - public static void registerStatement(IStatement statement) { - statements.put(statement.getUniqueTag(), statement); - } - - public static void registerParameterClass(Class param) { - parameters.put(createParameter(param).getUniqueTag(), param); - } - - @Deprecated - public static void registerParameterClass(String name, Class param) { - parameters.put(name, param); - } - - public static List getExternalTriggers(EnumFacing side, TileEntity entity) { - List result; - - if (entity instanceof IOverrideDefaultStatements) { - result = ((IOverrideDefaultStatements) entity).overrideTriggers(); - if (result != null) { - return result; - } - } - - result = new LinkedList(); - - for (ITriggerProvider provider : triggerProviders) { - Collection toAdd = provider.getExternalTriggers(side, entity); - - if (toAdd != null) { - for (ITriggerExternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } - } - - return result; - } - - public static List getExternalActions(EnumFacing side, TileEntity entity) { - List result = new LinkedList(); - - if (entity instanceof IOverrideDefaultStatements) { - result = ((IOverrideDefaultStatements) entity).overrideActions(); - if (result != null) { - return result; - } - } - - result = new LinkedList(); - - for (IActionProvider provider : actionProviders) { - Collection toAdd = provider.getExternalActions(side, entity); - - if (toAdd != null) { - for (IActionExternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } - } - - return result; - } - - public static List getInternalTriggers(IStatementContainer container) { - List result = new LinkedList(); - - for (ITriggerProvider provider : triggerProviders) { - Collection toAdd = provider.getInternalTriggers(container); - - if (toAdd != null) { - for (ITriggerInternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } - } - - return result; - } - - public static List getInternalActions(IStatementContainer container) { - List result = new LinkedList(); - - for (IActionProvider provider : actionProviders) { - Collection toAdd = provider.getInternalActions(container); - - if (toAdd != null) { - for (IActionInternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } - } - - return result; - } - - public static IStatementParameter createParameter(String kind) { - return createParameter(parameters.get(kind)); - } - - private static IStatementParameter createParameter(Class param) { - if (param == null) { - return null; - } - - try { - return param.newInstance(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (Error error) { - BCLog.logErrorAPI(error, IStatementParameter.class); - throw error; - } - - return null; - } - - // /** - // * Generally, this function should be called by every mod implementing - // * the Statements API ***as a container*** (that is, adding its own gates) - // * on the client side from a given Item of choice. - // */ - // @SideOnly(Side.CLIENT) - // public static void registerIcons(TextureAtlasSpriteRegister register) { - // for (IStatement statement : statements.values()) { - // statement.registerIcons(register); - // } - // - // for (Class parameter : parameters.values()) { - // createParameter(parameter).registerIcons(register); - // } - // } -} diff --git a/src/api/java/buildcraft/api/statements/StatementMouseClick.java b/src/api/java/buildcraft/api/statements/StatementMouseClick.java deleted file mode 100644 index c39ed336f..000000000 --- a/src/api/java/buildcraft/api/statements/StatementMouseClick.java +++ /dev/null @@ -1,23 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -public final class StatementMouseClick { - private int button; - private boolean shift; - - public StatementMouseClick(int button, boolean shift) { - this.button = button; - this.shift = shift; - } - - public boolean isShift() { - return shift; - } - - public int getButton() { - return button; - } -} diff --git a/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java b/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java deleted file mode 100644 index 3ed0ec5db..000000000 --- a/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java +++ /dev/null @@ -1,90 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import java.util.Objects; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public class StatementParameterItemStack implements IStatementParameter { - - protected ItemStack stack; - - @Override - public TextureAtlasSprite getIcon() { - return null; - } - - @Override - public ItemStack getItemStack() { - return stack; - } - - @Override - public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) { - if (stack != null) { - this.stack = stack.copy(); - this.stack.stackSize = 1; - } else { - this.stack = null; - } - } - - @Override - public void writeToNBT(NBTTagCompound compound) { - if (stack != null) { - NBTTagCompound tagCompound = new NBTTagCompound(); - stack.writeToNBT(tagCompound); - compound.setTag("stack", tagCompound); - } - } - - @Override - public void readFromNBT(NBTTagCompound compound) { - stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("stack")); - } - - @Override - public boolean equals(Object object) { - if (object instanceof StatementParameterItemStack) { - StatementParameterItemStack param = (StatementParameterItemStack) object; - - return ItemStack.areItemStacksEqual(stack, param.stack) && ItemStack.areItemStackTagsEqual(stack, param.stack); - } else { - return false; - } - } - - @Override - public int hashCode() { - return Objects.hashCode(stack); - } - - @Override - public String getDescription() { - if (stack != null) { - return stack.getDisplayName(); - } else { - return ""; - } - } - - @Override - public String getUniqueTag() { - return "buildcraft:stack"; - } - - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // - // } - - @Override - public IStatementParameter rotateLeft() { - return this; - } -} diff --git a/src/api/java/buildcraft/api/statements/StatementSlot.java b/src/api/java/buildcraft/api/statements/StatementSlot.java deleted file mode 100644 index 27c0071bb..000000000 --- a/src/api/java/buildcraft/api/statements/StatementSlot.java +++ /dev/null @@ -1,42 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.statements; - -import java.util.Arrays; -import java.util.Objects; - -public class StatementSlot { - public IStatement statement; - public IStatementParameter[] parameters; - - @Override - public boolean equals(Object o) { - if (!(o instanceof StatementSlot)) { - return false; - } - StatementSlot s = (StatementSlot) o; - if (s.statement != statement || parameters.length != s.parameters.length) { - return false; - } - for (int i = 0; i < parameters.length; i++) { - IStatementParameter p1 = parameters[i]; - IStatementParameter p2 = s.parameters[i]; - if (p1 == null) { - if (p2 != null) return false; - continue; - } - if (p2 == null) return false; - if (!(p1.equals(p2))) { - return false; - } - } - return true; - } - - @Override - public int hashCode() { - return Objects.hash(statement, Arrays.deepHashCode(parameters)); - } -} diff --git a/src/api/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java b/src/api/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java deleted file mode 100644 index 5b34bfd94..000000000 --- a/src/api/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java +++ /dev/null @@ -1,17 +0,0 @@ -package buildcraft.api.statements.containers; - -import net.minecraft.util.EnumFacing; - -public interface IRedstoneStatementContainer { - /** Get the redstone input from a given side. - * - * @param side The side - use "UNKNOWN" for maximum input. - * @return The redstone input, from 0 to 15. */ - int getRedstoneInput(EnumFacing side); - - /** Set the redstone input for a given side. - * - * @param side The side - use "UNKNOWN" for all sides. - * @return Whether the set was successful. */ - boolean setRedstoneOutput(EnumFacing side, int value); -} diff --git a/src/api/java/buildcraft/api/statements/containers/ISidedStatementContainer.java b/src/api/java/buildcraft/api/statements/containers/ISidedStatementContainer.java deleted file mode 100644 index b65ace45a..000000000 --- a/src/api/java/buildcraft/api/statements/containers/ISidedStatementContainer.java +++ /dev/null @@ -1,10 +0,0 @@ -package buildcraft.api.statements.containers; - -import net.minecraft.util.EnumFacing; - -import buildcraft.api.statements.IStatementContainer; - -/** Created by asie on 3/14/15. */ -public interface ISidedStatementContainer extends IStatementContainer { - EnumFacing getSide(); -} diff --git a/src/api/java/buildcraft/api/statements/package-info.java b/src/api/java/buildcraft/api/statements/package-info.java deleted file mode 100644 index 7dd2c74e6..000000000 --- a/src/api/java/buildcraft/api/statements/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|statements") -package buildcraft.api.statements; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/tablet/ITablet.java b/src/api/java/buildcraft/api/tablet/ITablet.java deleted file mode 100644 index 09b3af4a2..000000000 --- a/src/api/java/buildcraft/api/tablet/ITablet.java +++ /dev/null @@ -1,18 +0,0 @@ -package buildcraft.api.tablet; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fml.relauncher.Side; - -public interface ITablet { - Side getSide(); - - void refreshScreen(TabletBitmap data); - - int getScreenWidth(); - - int getScreenHeight(); - - void launchProgram(String name); - - void sendMessage(NBTTagCompound compound); -} diff --git a/src/api/java/buildcraft/api/tablet/TabletAPI.java b/src/api/java/buildcraft/api/tablet/TabletAPI.java deleted file mode 100644 index 529862790..000000000 --- a/src/api/java/buildcraft/api/tablet/TabletAPI.java +++ /dev/null @@ -1,20 +0,0 @@ -package buildcraft.api.tablet; - -import java.util.HashMap; -import java.util.Map; - -public final class TabletAPI { - private static final Map programs = new HashMap(); - - private TabletAPI() { - - } - - public static void registerProgram(TabletProgramFactory factory) { - programs.put(factory.getName(), factory); - } - - public static TabletProgramFactory getProgram(String name) { - return programs.get(name); - } -} diff --git a/src/api/java/buildcraft/api/tablet/TabletBitmap.java b/src/api/java/buildcraft/api/tablet/TabletBitmap.java deleted file mode 100644 index 82b236b9f..000000000 --- a/src/api/java/buildcraft/api/tablet/TabletBitmap.java +++ /dev/null @@ -1,55 +0,0 @@ -package buildcraft.api.tablet; - -public class TabletBitmap { - public final int width, height; - protected int[] data; - - public TabletBitmap(int width, int height) { - this.width = width; - this.height = height; - this.data = new int[width * height]; - } - - public TabletBitmap(ITablet tablet) { - this(tablet.getScreenWidth(), tablet.getScreenHeight()); - } - - public int[] getData() { - return data; - } - - public int get(int x, int y) { - if (x < 0 || y < 0 || x >= width || y >= height) { - return 0; - } - return data[y * width + x]; - } - - public void set(int x, int y, int shade) { - if (x < 0 || y < 0 || x >= width || y >= height) { - return; - } - data[y * width + x] = shade; - } - - public void set(int x, int y, TabletBitmap bitmap) { - for (int i = 0; i < bitmap.height; i++) { - if (i >= height) { - break; - } - for (int h = 0; h < bitmap.width; h++) { - if (h >= width) { - break; - } - - set(x + h, y + i, bitmap.get(h, i)); - } - } - } - - public TabletBitmap duplicate() { - TabletBitmap cloned = new TabletBitmap(this.width, this.height); - cloned.data = this.data.clone(); - return cloned; - } -} diff --git a/src/api/java/buildcraft/api/tablet/TabletProgram.java b/src/api/java/buildcraft/api/tablet/TabletProgram.java deleted file mode 100644 index ea098f47c..000000000 --- a/src/api/java/buildcraft/api/tablet/TabletProgram.java +++ /dev/null @@ -1,17 +0,0 @@ -package buildcraft.api.tablet; - -import net.minecraft.nbt.NBTTagCompound; - -public abstract class TabletProgram { - public void tick(float time) { - - } - - public boolean hasEnded() { - return false; - } - - public void receiveMessage(NBTTagCompound compound) { - - } -} diff --git a/src/api/java/buildcraft/api/tablet/TabletProgramFactory.java b/src/api/java/buildcraft/api/tablet/TabletProgramFactory.java deleted file mode 100644 index 8f3bb414c..000000000 --- a/src/api/java/buildcraft/api/tablet/TabletProgramFactory.java +++ /dev/null @@ -1,19 +0,0 @@ -package buildcraft.api.tablet; - -public abstract class TabletProgramFactory { - /** Create an instance of the tablet program specified by this Factory. - * - * Both parameters are mutable and can be edited freely; however, the NBTTagCompound will only be synchronized after - * you leave the program. - * - * Please note that the program runs client-side SOLELY. For server-side queries, you must implement a custom - * communications protocol. - * - * @param tablet - * @return An instance of the TabletProgram. */ - public abstract TabletProgram create(ITablet tablet); - - public abstract String getName(); - - public abstract TabletBitmap getIcon(); -} diff --git a/src/api/java/buildcraft/api/tablet/TabletTicker.java b/src/api/java/buildcraft/api/tablet/TabletTicker.java deleted file mode 100644 index 33656fb80..000000000 --- a/src/api/java/buildcraft/api/tablet/TabletTicker.java +++ /dev/null @@ -1,36 +0,0 @@ -package buildcraft.api.tablet; - -/** Utility class for capturing tablet ticks every X seconds. */ -public class TabletTicker { - private final float tickTime; - private float time = 0.0F; - private int ticked = 0; - - public TabletTicker(float tickTime) { - this.tickTime = tickTime; - } - - public void add(float time) { - this.time += time; - - while (this.time >= tickTime) { - this.time -= tickTime; - ticked++; - } - } - - public int getTicks() { - return ticked; - } - - public boolean tick() { - boolean oldTicked = ticked > 0; - ticked = 0; - return oldTicked; - } - - public void reset() { - ticked = 0; - time = 0; - } -} diff --git a/src/api/java/buildcraft/api/tablet/package-info.java b/src/api/java/buildcraft/api/tablet/package-info.java deleted file mode 100644 index cc87d8657..000000000 --- a/src/api/java/buildcraft/api/tablet/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|tablet") -package buildcraft.api.tablet; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/tiles/IControllable.java b/src/api/java/buildcraft/api/tiles/IControllable.java deleted file mode 100644 index 46eff5f12..000000000 --- a/src/api/java/buildcraft/api/tiles/IControllable.java +++ /dev/null @@ -1,34 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.tiles; - -/** This interface should be implemented by any Tile Entity which wishes to have non-redstone automation (for example, - * BuildCraft Gates, but also other mods which implement it, e.g. OpenComputers). */ -public interface IControllable { - public enum Mode { - Unknown, - On, - Off, - Mode, - Loop - } - - /** Get the current control mode of the Tile Entity. - * - * @return */ - Mode getControlMode(); - - /** Set the mode of the Tile Entity. - * - * @param mode */ - void setControlMode(Mode mode); - - /** Check if a given control mode is accepted. If you query IControllable tiles, you MUST check with - * acceptsControlMode first. - * - * @param mode - * @return True if this control mode is accepted. */ - boolean acceptsControlMode(Mode mode); -} diff --git a/src/api/java/buildcraft/api/tiles/IDebuggable.java b/src/api/java/buildcraft/api/tiles/IDebuggable.java deleted file mode 100644 index e8af6d3f5..000000000 --- a/src/api/java/buildcraft/api/tiles/IDebuggable.java +++ /dev/null @@ -1,16 +0,0 @@ -package buildcraft.api.tiles; - -import java.util.List; - -import net.minecraft.util.EnumFacing; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IDebuggable { - /** Get the debug information from a tile entity as a list of strings, used for the F3 debug menu. The left and - * right parameters correspond to the sides of the F3 screen. - * - * @param side The side the block was clicked on, may be null if we don't know, or is the "centre" side */ - @SideOnly(Side.CLIENT) - void getDebugInfo(List left, List right, EnumFacing side); -} diff --git a/src/api/java/buildcraft/api/tiles/IHasWork.java b/src/api/java/buildcraft/api/tiles/IHasWork.java deleted file mode 100644 index fa8719644..000000000 --- a/src/api/java/buildcraft/api/tiles/IHasWork.java +++ /dev/null @@ -1,14 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.tiles; - -/** This interface should be implemented by any Tile Entity which carries out work (crafting, ore processing, mining, et - * cetera). */ -public interface IHasWork { - /** Check if the Tile Entity is currently doing any work. - * - * @return True if the Tile Entity is doing work. */ - boolean hasWork(); -} diff --git a/src/api/java/buildcraft/api/tiles/IHeatable.java b/src/api/java/buildcraft/api/tiles/IHeatable.java deleted file mode 100644 index 1af6d6b59..000000000 --- a/src/api/java/buildcraft/api/tiles/IHeatable.java +++ /dev/null @@ -1,26 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.tiles; - -/** This interface should be implemented by Tile Entities which have an internal heat value. */ -public interface IHeatable { - /** @return The minimum heat value, in degrees. */ - double getMinHeatValue(); - - /** @return The preferred heat value, in degrees. */ - double getIdealHeatValue(); - - /** @return The maxmimum heat value, in degrees. */ - double getMaxHeatValue(); - - /** @return The current heat value, in degrees. */ - double getCurrentHeatValue(); - - /** Set the heat of the tile. - * - * @param value Heat value, in degrees. - * @return The heat the tile has after the set. */ - double setHeatValue(double value); -} diff --git a/src/api/java/buildcraft/api/tiles/ITileAreaProvider.java b/src/api/java/buildcraft/api/tiles/ITileAreaProvider.java deleted file mode 100644 index 8b5ee48a9..000000000 --- a/src/api/java/buildcraft/api/tiles/ITileAreaProvider.java +++ /dev/null @@ -1,10 +0,0 @@ -package buildcraft.api.tiles; - -import net.minecraft.util.BlockPos; - -import buildcraft.api.core.IAreaProvider; - -/** Used for more fine-grained control of whether or not a machine connects to the provider here. */ -public interface ITileAreaProvider extends IAreaProvider { - boolean isValidFromLocation(BlockPos pos); -} diff --git a/src/api/java/buildcraft/api/tiles/package-info.java b/src/api/java/buildcraft/api/tiles/package-info.java deleted file mode 100644 index d4c217fc3..000000000 --- a/src/api/java/buildcraft/api/tiles/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.2", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|tiles") -package buildcraft.api.tiles; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/tools/IToolWrench.java b/src/api/java/buildcraft/api/tools/IToolWrench.java deleted file mode 100644 index 0138fdf91..000000000 --- a/src/api/java/buildcraft/api/tools/IToolWrench.java +++ /dev/null @@ -1,33 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.tools; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; - -/*** Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft */ -public interface IToolWrench { - - /*** Called to ensure that the wrench can be used. To get the ItemStack that is used, check - * player.inventory.getCurrentItem() - * - * @param player - The player doing the wrenching - * @param pos - The coordinates for the block being wrenched - * - * @return true if wrenching is allowed, false if not */ - boolean canWrench(EntityPlayer player, BlockPos pos); - - /*** Callback after the wrench has been used. This can be used to decrease durability or for other purposes. To get - * the ItemStack that was used, check player.inventory.getCurrentItem() - * - * @param player - The player doing the wrenching - * @param pos - The position of the block being wrenched */ - void wrenchUsed(EntityPlayer player, BlockPos pos); - - boolean canWrench(EntityPlayer player, Entity entity); - - void wrenchUsed(EntityPlayer player, Entity entity); -} diff --git a/src/api/java/buildcraft/api/tools/package-info.java b/src/api/java/buildcraft/api/tools/package-info.java deleted file mode 100644 index 873fba1b0..000000000 --- a/src/api/java/buildcraft/api/tools/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|tools") -package buildcraft.api.tools; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/transport/ICustomPipeConnection.java b/src/api/java/buildcraft/api/transport/ICustomPipeConnection.java deleted file mode 100644 index c4cc1efdf..000000000 --- a/src/api/java/buildcraft/api/transport/ICustomPipeConnection.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api.transport; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -public interface ICustomPipeConnection { - /** @return How long the connecting pipe should extend for. Values less than -4/16 indicate that the pipe will not - * connect at all, and will render as it it was not connected. */ - public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state); -} diff --git a/src/api/java/buildcraft/api/transport/IInjectable.java b/src/api/java/buildcraft/api/transport/IInjectable.java deleted file mode 100644 index 0de9e2005..000000000 --- a/src/api/java/buildcraft/api/transport/IInjectable.java +++ /dev/null @@ -1,18 +0,0 @@ -package buildcraft.api.transport; - -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; - -public interface IInjectable { - boolean canInjectItems(EnumFacing from); - - /** Offers an ItemStack for 3addition to the pipe. Will be rejected if the pipe doesn't accept items from that side. - * - * @param stack ItemStack offered for addition. Do not manipulate this! - * @param doAdd If false no actual addition should take place. Implementors should simulate. - * @param from Orientation the ItemStack is offered from. - * @param color The color of the item to be added to the pipe, or null for no color. - * @return Amount of items used from the passed stack. */ - int injectItem(ItemStack stack, boolean doAdd, EnumFacing from, EnumDyeColor color); -} diff --git a/src/api/java/buildcraft/api/transport/IItemPipe.java b/src/api/java/buildcraft/api/transport/IItemPipe.java deleted file mode 100644 index c943a81a6..000000000 --- a/src/api/java/buildcraft/api/transport/IItemPipe.java +++ /dev/null @@ -1,11 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.transport; - -/** To be implemented by the real item pipe in Transport mod, but leaves knowledge for classes that do not have direct - * dependency on transport. */ -public interface IItemPipe { - -} diff --git a/src/api/java/buildcraft/api/transport/IPipe.java b/src/api/java/buildcraft/api/transport/IPipe.java deleted file mode 100644 index 96a7a764c..000000000 --- a/src/api/java/buildcraft/api/transport/IPipe.java +++ /dev/null @@ -1,21 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import net.minecraft.util.EnumFacing; - -import buildcraft.api.gates.IGate; - -public interface IPipe { - IPipeTile getTile(); - - IGate getGate(EnumFacing side); - - boolean hasGate(EnumFacing side); - - boolean isWired(PipeWire wire); - - boolean isWireActive(PipeWire wire); -} diff --git a/src/api/java/buildcraft/api/transport/IPipeConnection.java b/src/api/java/buildcraft/api/transport/IPipeConnection.java deleted file mode 100644 index 0b25ec818..000000000 --- a/src/api/java/buildcraft/api/transport/IPipeConnection.java +++ /dev/null @@ -1,24 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import net.minecraft.util.EnumFacing; - -public interface IPipeConnection { - - enum ConnectOverride { - - CONNECT, - DISCONNECT, - DEFAULT - } - - /** Allows you to override pipe connection logic. - * - * @param type - * @param with - * @return CONNECT to force a connection, DISCONNECT to force no connection, and DEFAULT to let the pipe decide. */ - ConnectOverride overridePipeConnection(IPipeTile.PipeType type, EnumFacing with); -} diff --git a/src/api/java/buildcraft/api/transport/IPipeTile.java b/src/api/java/buildcraft/api/transport/IPipeTile.java deleted file mode 100644 index d8d38c234..000000000 --- a/src/api/java/buildcraft/api/transport/IPipeTile.java +++ /dev/null @@ -1,54 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import net.minecraft.block.Block; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -import buildcraft.api.transport.pluggable.PipePluggable; - -public interface IPipeTile extends IInjectable { - enum PipeType { - ITEM, - FLUID, - POWER, - STRUCTURE - } - - PipeType getPipeType(); - - World getWorldBC(); - - BlockPos getPosBC(); - - /** True if the pipe is connected to the block/pipe in the specific direction - * - * @param with - * @return true if connect */ - boolean isPipeConnected(EnumFacing with); - - Block getNeighborBlock(EnumFacing dir); - - TileEntity getNeighborTile(EnumFacing dir); - - IPipe getNeighborPipe(EnumFacing dir); - - IPipe getPipe(); - - int getPipeColor(); - - PipePluggable getPipePluggable(EnumFacing direction); // Now in IPluggableProvider - - boolean hasPipePluggable(EnumFacing direction); // Now in IPluggableProvider - - boolean hasBlockingPluggable(EnumFacing direction); - - void scheduleNeighborChange(); - - void scheduleRenderUpdate(); -} diff --git a/src/api/java/buildcraft/api/transport/IStripesActivator.java b/src/api/java/buildcraft/api/transport/IStripesActivator.java deleted file mode 100644 index 540346d7b..000000000 --- a/src/api/java/buildcraft/api/transport/IStripesActivator.java +++ /dev/null @@ -1,14 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; - -public interface IStripesActivator { - void sendItem(ItemStack itemStack, EnumFacing direction); - - void dropItem(ItemStack itemStack, EnumFacing direction); -} diff --git a/src/api/java/buildcraft/api/transport/IStripesHandler.java b/src/api/java/buildcraft/api/transport/IStripesHandler.java deleted file mode 100644 index 71f420552..000000000 --- a/src/api/java/buildcraft/api/transport/IStripesHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -public interface IStripesHandler { - enum StripesHandlerType { - ITEM_USE, - BLOCK_BREAK - } - - StripesHandlerType getType(); - - boolean shouldHandle(ItemStack stack); - - boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator); -} diff --git a/src/api/java/buildcraft/api/transport/IStripesPipe.java b/src/api/java/buildcraft/api/transport/IStripesPipe.java deleted file mode 100644 index 569c53954..000000000 --- a/src/api/java/buildcraft/api/transport/IStripesPipe.java +++ /dev/null @@ -1,9 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import cofh.api.energy.IEnergyHandler; - -public interface IStripesPipe extends IPipe, IStripesActivator, IEnergyHandler {} diff --git a/src/api/java/buildcraft/api/transport/PipeConnectionAPI.java b/src/api/java/buildcraft/api/transport/PipeConnectionAPI.java deleted file mode 100644 index e79da2646..000000000 --- a/src/api/java/buildcraft/api/transport/PipeConnectionAPI.java +++ /dev/null @@ -1,48 +0,0 @@ -package buildcraft.api.transport; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -/** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you - * do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered - * version does not override your own implementation. */ -public final class PipeConnectionAPI { - private static final Map connections = Maps.newHashMap(); - private static final ICustomPipeConnection NOTHING = new ICustomPipeConnection() { - @Override - public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state) { - return 0; - } - }; - - /** Register a block with a custom connection. Useful if you don't own the block class or are adding it for some-one - * - * @param block The block instance - * @param connection The connection instance */ - public static void registerConnection(Block block, ICustomPipeConnection connection) { - connections.put(block, connection); - } - - public static void registerConnectionAsNothing(Block block) { - connections.put(block, NOTHING); - } - - /** Gets the current custom connection that the block uses. Will be null if nothing has been set. */ - public static ICustomPipeConnection getCustomConnection(Block block) { - if (block instanceof ICustomPipeConnection) { - return (ICustomPipeConnection) block; - } - ICustomPipeConnection connection = connections.get(block); - if (connection != null) { - return connection; - } - return null; - } -} diff --git a/src/api/java/buildcraft/api/transport/PipeManager.java b/src/api/java/buildcraft/api/transport/PipeManager.java deleted file mode 100644 index 0fd0f8aad..000000000 --- a/src/api/java/buildcraft/api/transport/PipeManager.java +++ /dev/null @@ -1,71 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -import buildcraft.api.transport.pluggable.PipePluggable; - -public abstract class PipeManager { - - public static List stripesHandlers = new ArrayList(); - public static ArrayList> pipePluggables = new ArrayList>(); - private static Map> pipePluggableNames = new HashMap>(); - private static Map, String> pipePluggableByNames = new HashMap, String>(); - private static Map stripesHandlerPriorities = new HashMap(); - - @Deprecated - public static boolean canExtractItems(Object extractor, World world, BlockPos pos) { - return true; - } - - @Deprecated - public static boolean canExtractFluids(Object extractor, World world, BlockPos pos) { - return true; - } - - @Deprecated - public static void registerStripesHandler(IStripesHandler handler) { - registerStripesHandler(handler, 0); - } - - /** Register a Stripes Pipe handler. - * - * @param handler The handler. - * @param priority The priority - 0 is normal, higher numbers have higher priority. */ - public static void registerStripesHandler(IStripesHandler handler, int priority) { - stripesHandlers.add(handler); - stripesHandlerPriorities.put(handler, priority); - - Collections.sort(stripesHandlers, new Comparator() { - @Override - public int compare(IStripesHandler o1, IStripesHandler o2) { - return stripesHandlerPriorities.get(o2) - stripesHandlerPriorities.get(o1); - } - }); - } - - public static void registerPipePluggable(Class pluggable, String name) { - pipePluggables.add(pluggable); - pipePluggableNames.put(name, pluggable); - pipePluggableByNames.put(pluggable, name); - } - - public static Class getPluggableByName(String pluggableName) { - return pipePluggableNames.get(pluggableName); - } - - public static String getPluggableName(Class aClass) { - return pipePluggableByNames.get(aClass); - } -} diff --git a/src/api/java/buildcraft/api/transport/PipeWire.java b/src/api/java/buildcraft/api/transport/PipeWire.java deleted file mode 100644 index 5864db9c3..000000000 --- a/src/api/java/buildcraft/api/transport/PipeWire.java +++ /dev/null @@ -1,73 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import java.util.Locale; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public enum PipeWire { - - RED, - BLUE, - GREEN, - YELLOW; - public static Item item; - public static final PipeWire[] VALUES = values(); - - public PipeWire reverse() { - switch (this) { - case RED: - return YELLOW; - case BLUE: - return GREEN; - case GREEN: - return BLUE; - default: - return RED; - } - } - - public String getTag() { - return name().toLowerCase(Locale.ENGLISH) + "PipeWire"; - } - - public String getColor() { - String name = this.toString().toLowerCase(Locale.ENGLISH); - char first = Character.toUpperCase(name.charAt(0)); - return first + name.substring(1); - } - - public ItemStack getStack() { - return getStack(1); - } - - public ItemStack getStack(int qty) { - if (item == null) { - return null; - } else { - return new ItemStack(item, qty, ordinal()); - } - } - - public boolean isPipeWire(ItemStack stack) { - if (stack == null) { - return false; - } else if (stack.getItem() != item) { - return false; - } else { - return stack.getItemDamage() == ordinal(); - } - } - - public static PipeWire fromOrdinal(int ordinal) { - if (ordinal < 0 || ordinal >= VALUES.length) { - return RED; - } else { - return VALUES[ordinal]; - } - } -} diff --git a/src/api/java/buildcraft/api/transport/package-info.java b/src/api/java/buildcraft/api/transport/package-info.java deleted file mode 100644 index 004c271a1..000000000 --- a/src/api/java/buildcraft/api/transport/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "5.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|transport") -package buildcraft.api.transport; - -import net.minecraftforge.fml.common.API; diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/BCPipeEventHandler.java b/src/api/java/buildcraft/api/transport/pipe_bc8/BCPipeEventHandler.java deleted file mode 100644 index bb163b9f0..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/BCPipeEventHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(value = ElementType.METHOD) -@Retention(value = RetentionPolicy.RUNTIME) -public @interface BCPipeEventHandler { - // TODO -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/EnumContentsJourneyPart.java b/src/api/java/buildcraft/api/transport/pipe_bc8/EnumContentsJourneyPart.java deleted file mode 100644 index 3bf724a42..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/EnumContentsJourneyPart.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -public enum EnumContentsJourneyPart { - JUST_ENTERED, - TO_CENTER, - FROM_CENTER; -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IConnection_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IConnection_BC8.java deleted file mode 100644 index a18140f6b..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IConnection_BC8.java +++ /dev/null @@ -1,35 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; - -import buildcraft.api.transport.pipe_bc8.IExtractionManager.IExtractable_BC8; -import buildcraft.api.transport.pipe_bc8.IInsertionManager.IInsertable_BC8; - -public interface IConnection_BC8 { - Object getOther(); - - /** @return The length of the connection. For connections to another buildcraft pipe or a full block this value will - * be 0.25. Values less than 0 are NOT permitted and returning values less than 0 will introduce crashes or - * errors further down! */ - double getLength(); - - IExtractable_BC8 getExtractor(); - - IInsertable_BC8 getInserter(); - - interface Pipe extends IConnection_BC8 { - @Override - IPipe_BC8 getOther(); - } - - interface MovableEntity extends IConnection_BC8 { - @Override - Entity getOther(); - } - - interface Tile extends IConnection_BC8 { - @Override - TileEntity getOther(); - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IExtractionManager.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IExtractionManager.java deleted file mode 100644 index 0983d7d16..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IExtractionManager.java +++ /dev/null @@ -1,46 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.IFluidFilter; -import buildcraft.api.core.IStackFilter; -import buildcraft.api.transport.pipe_bc8.IInsertionManager.IInsertableFactory; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableFluid; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableItem; - -public interface IExtractionManager { - /** Gets an {@link IExtractable_BC8} interface for a given tile or movable entity. */ - IExtractable_BC8 getExtractableFor(Object obj); - - /** Registers an {@link IInsertableFactory}. Note that if two insertables are registered and have an overlapping - * class child, the most specific one is used. */ - void registerInsertable(Class clazz, IExtractableFactory factory); - - public interface IExtractableFactory { - IExtractable_BC8 createNew(T obj); - } - - public interface IExtractable_BC8 { - /** @param filter The filter to use when determining what can be extracted - * @param extractor The object the the contents are being extracted by - * @param direction The direction the contents will be going in - * @param simulate If true no changes will be made to the target inventory - * @return A pipe contents object if it was successfully extracted, or null if nothing was extracted. */ - IPipeContentsEditableItem tryExtractItems(IStackFilter filter, Object extractor, EnumFacing direction, boolean simulate); - - /** @param filter The filter to use when determining what can be extracted - * @param extractor The object the the contents are being extracted by - * @param direction The direction the contents will be going in - * @param simulate If true no changes will be made to the target tank - * @return A pipe contents object if it was successfully extracted, or null if nothing was extracted. */ - IPipeContentsEditableFluid tryExtractFluid(IFluidFilter filter, Object extractor, EnumFacing direction, boolean simulate); - - /** @return True if {@link #tryExtractItems(IStackFilter, Object, EnumFacing, boolean)} can return a non-null - * value at any future point in time. */ - boolean givesItems(); - - /** @return True if {@link #tryExtractFluid(IFluidFilter, Object, EnumFacing, boolean)} can return a non-null - * value at any future point in time. */ - boolean givesFluids(); - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IInsertionManager.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IInsertionManager.java deleted file mode 100644 index 0ae64a68a..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IInsertionManager.java +++ /dev/null @@ -1,35 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.IFluidFilter; -import buildcraft.api.core.IStackFilter; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableFluid; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableItem; - -public interface IInsertionManager { - /** Gets an {@link IInsertable_BC8} interface for a given tile or movable entity. */ - IInsertable_BC8 getInsertableFor(Object obj); - - /** Registers an {@link IInsertableFactory}. Note that if two insertables are registered and have an overlapping - * class child, the most specific one is used. */ - void registerInsertable(Class clazz, IInsertableFactory factory); - - public interface IInsertableFactory { - IInsertable_BC8 createNew(T obj); - } - - public interface IInsertable_BC8 { - boolean tryInsertItems(IPipeContentsEditableItem contents, Object extractor, EnumFacing direction, boolean simulate); - - boolean tryInsertFluid(IPipeContentsEditableFluid fluid, Object extractor, EnumFacing direction, boolean simulate); - - /** @return True if {@link #tryExtractItems(IStackFilter, Object, EnumFacing, boolean)} can return a non-null - * value at any future point in time. */ - boolean acceptsItems(); - - /** @return True if {@link #tryExtractFluid(IFluidFilter, Object, EnumFacing, boolean)} can return a non-null - * value at any future point in time. */ - boolean acceptsFluids(); - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeAddonItem.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeAddonItem.java deleted file mode 100644 index fa98b71df..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeAddonItem.java +++ /dev/null @@ -1,8 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -/** - * - */ -public interface IPipeAddonItem { - -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeBehaviourFactory.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeBehaviourFactory.java deleted file mode 100644 index 8fa7afb23..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeBehaviourFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -public interface IPipeBehaviourFactory { - PipeBehaviour_BC8 createNew(IPipe_BC8 pipe); -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContents.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContents.java deleted file mode 100644 index 23e16eeb2..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContents.java +++ /dev/null @@ -1,37 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -/** Provides a simple abstraction for items and fluids. This is intended to be useful for pipes which cover both kinds, - * without having lots of if (item) ... else ... */ -public interface IPipeContents { - EnumContentsJourneyPart getJourneyPart(); - - EnumFacing getDirection(); - - /** This should NEVER return numbers less than or equal to 0! - * - * @return The number of minecraft blocks this contents moves per minecraft ticks */ - double getSpeed(); - - public interface IPipeContentsItem extends IPipeContents { - ItemStack cloneItemStack(); - - IPipePropertyProvider getProperties(); - } - - public interface IPipeContentsFluid extends IPipeContents { - int getAmount(); - - Fluid getFluid(); - - NBTTagCompound getNBT(); - - FluidStack cloneFluidStack(); - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java deleted file mode 100644 index 789772f12..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java +++ /dev/null @@ -1,60 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; - -import net.minecraftforge.fluids.Fluid; - -import buildcraft.api.core.INBTLoadable_BC8; -import buildcraft.api.core.INetworkLoadable_BC8; -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyProviderEditable; - -import io.netty.buffer.ByteBuf; - -/** Provides a way to change the contents of a pipe. */ -public interface IPipeContentsEditable extends IPipeContents, INetworkLoadable_BC8, INBTLoadable_BC8 { - IPipeContents asReadOnly(); - - void setJourneyPart(EnumContentsJourneyPart journeyPart); - - void setDirection(EnumFacing direction); - - void setSpeed(double speed); - - public interface IPipeContentsEditableFluid extends IPipeContentsEditable, IPipeContentsFluid { - int setAmount(int newAmount); - - void setFluid(Fluid fluid); - - void setNBT(NBTTagCompound compound); - - void setFluidStack(); - - @Override - IPipeContentsFluid asReadOnly(); - - @Override - IPipeContentsEditableFluid readFromNBT(NBTBase nbt); - - @Override - IPipeContentsEditableFluid readFromByteBuf(ByteBuf buf); - } - - public interface IPipeContentsEditableItem extends IPipeContentsEditable, IPipeContentsItem { - void setStack(ItemStack newStack); - - @Override - IPipePropertyProviderEditable getProperties(); - - @Override - IPipeContentsItem asReadOnly(); - - @Override - IPipeContentsEditableItem readFromNBT(NBTBase nbt); - - @Override - IPipeContentsEditableItem readFromByteBuf(ByteBuf buf); - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHelper.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHelper.java deleted file mode 100644 index 1d39da2b1..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHelper.java +++ /dev/null @@ -1,14 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.FluidStack; - -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableFluid; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableItem; - -public interface IPipeHelper { - IPipeContentsEditableItem getContentsForItem(ItemStack stack); - - IPipeContentsEditableFluid getContentsForFluid(FluidStack fluid); -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHolder_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHolder_BC8.java deleted file mode 100644 index 1d2abc738..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHolder_BC8.java +++ /dev/null @@ -1,5 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -public interface IPipeHolder_BC8 { - IPipe_BC8 getPipe(); -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListener.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListener.java deleted file mode 100644 index 1533faf59..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListener.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import buildcraft.api.core.INBTLoadable_BC8; -import buildcraft.api.core.INetworkLoadable_BC8; - -/** Something that will be saved and loaded from disk and sent across the network to the client world to be added as a - * listener. This class should be registered with {@link PipeAPI_BC8#PIPE_LISTENER_REGISTRY} in order to be successfully - * saved and loaded. */ -public interface IPipeListener extends INBTLoadable_BC8, INetworkLoadable_BC8 {} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListenerFactory.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListenerFactory.java deleted file mode 100644 index d2e96cf3d..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListenerFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -public interface IPipeListenerFactory { - IPipeListener createNewListener(IPipe_BC8 pipe); -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListenerRegistry.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListenerRegistry.java deleted file mode 100644 index abe78251d..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListenerRegistry.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -public interface IPipeListenerRegistry { - IPipeListenerFactory getFactory(String globalUniqueTag); - - String getGlobalUniqueTag(IPipeListener listener); - - void registerListenerFactory(String modUniqueTag, IPipeListenerFactory factory); -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipePropertyProvider.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipePropertyProvider.java deleted file mode 100644 index 5581d82ff..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipePropertyProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.util.Set; - -import net.minecraft.nbt.NBTBase; - -import buildcraft.api.core.INBTLoadable_BC8; -import buildcraft.api.core.INetworkLoadable_BC8; - -public interface IPipePropertyProvider { - /** This will return either the value of the property (if {@link #hasProperty(IPipeProperty)} returns true) or the - * default value of the property. */ - T getValue(IPipeProperty property); - - boolean hasProperty(IPipeProperty property); - - Set> getPropertySet(); - - /** Defines a property key- this should be stored in a publicly accessible static variable somewhere. */ - public interface IPipeProperty { - String getName(); - - T getDefault(); - } - - /** Defines a pipe property that has its value queried every time it is asked for its value. */ - public interface IPipePropertyImplicit extends IPipeProperty { - T getValue(IPipe_BC8 pipe); - } - - /** Defines a pipe property that has a value explicitly set */ - public interface IPipePropertyValue extends IPipeProperty, INBTLoadable_BC8, INetworkLoadable_BC8 { - T getValue(); - - @Override - T readFromNBT(NBTBase tag); - } - - /** Defines a provider that can have value properties changed and added. */ - public interface IPipePropertyProviderEditable extends IPipePropertyProvider, INBTLoadable_BC8, - INetworkLoadable_BC8 { - void addProperty(IPipePropertyValue property); - - void removeProperty(IPipePropertyValue property); - - IPipePropertyProvider asReadOnly(); - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeRegistry.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeRegistry.java deleted file mode 100644 index ca0ec628b..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeRegistry.java +++ /dev/null @@ -1,11 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.item.Item; - -import buildcraft.api.ITripleRegistry; - -public interface IPipeRegistry extends ITripleRegistry { - /** Registers a definition, returning the item associated with it. Note that the item has not been registered, so - * you still need to register it with forge. */ - Item registerDefinition(PipeDefinition_BC8 definition); -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeType.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeType.java deleted file mode 100644 index 28deb4eee..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeType.java +++ /dev/null @@ -1,22 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.util.Collections; -import java.util.List; - -public interface IPipeType { - /** Creates all of the default listeners for this pipe. Normally this will be a list with a single object, that will - * normally be a pipe transport. However, you can use this to register any listeners you wish. */ - List createDefaultListeners(IPipe_BC8 pipe); - - enum Void implements IPipeType { - STRUCTURE, - POWER, - FLUID, - ITEM; - - @Override - public List createDefaultListeners(IPipe_BC8 pipe) { - return Collections.emptyList(); - } - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipe_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipe_BC8.java deleted file mode 100644 index 66dc2037c..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipe_BC8.java +++ /dev/null @@ -1,50 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.util.Map; - -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -import buildcraft.api.core.INBTLoadable_BC8; -import buildcraft.api.transport.pipe_bc8.event_bc8.IPipeEvent_BC8; - -/** Represents a pipe in a world. Most older (BC version less than 8.x) events, functions and querys can be called by - * firing the appropriate event, and inspecting the event afterwards. Most functionality has been delegated to */ -/* Note that this does not have a "get pipe tile" method, as pipes are not bound to just tile entities */ -public interface IPipe_BC8 extends INBTLoadable_BC8 { - World getWorld(); - - IPipeHolder_BC8 getHolder(); - - IPipePropertyProvider getProperties(); - - PipeBehaviour_BC8 getBehaviour(); - - Map getConnections(); - - void fireEvent(IPipeEvent_BC8 event); - - /** Adds an event listener that will be saved and sent over the network. - * - * @return True if the listener was added to the listener bus. If this returns false it will usually be todo with - * the listener not being allowed onto the pipe (for example it was a gate and there was already a gate on - * that side, or a facade or something similar to that) */ - boolean addEventListener(IPipeListener list); - - void removeEventListener(IPipeListener list); - - /** Sends all of the network data about this listener to the client. Note that this is called automatically by - * {@link #addEventListener(IPipeListener)}. */ - void sendClientUpdate(IPipeListener listener); - - /** Makes this pipe send a client update at some point in the future. This might send it now, or it might send it - * next tick. */ - void scheduleClientUpdate(IPipeListener listener); - - /** Makes this pipe re-render its static parts. */ - void sendRenderUpdate(); - - /** Makes this pipe send a render update at some point in the future. This might send it now, or it might send it in - * a few ticks time. */ - void scheduleRenderUpdate(); -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPluggable_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPluggable_BC8.java deleted file mode 100644 index 414f10458..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPluggable_BC8.java +++ /dev/null @@ -1,8 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import buildcraft.api.core.INBTLoadable_BC8; -import buildcraft.api.core.INetworkLoadable_BC8; - -public interface IPluggable_BC8 extends INetworkLoadable_BC8, INBTLoadable_BC8 { - -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPropertyRegistry.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPropertyRegistry.java deleted file mode 100644 index 5d54e5f94..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPropertyRegistry.java +++ /dev/null @@ -1,48 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyImplicit; -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyValue; - -public interface IPropertyRegistry { - IPipePropertyValue getValueProperty(String modId, String name); - - IPipePropertyValue registerValueProperty(String name, Class typeClass); - - IPipePropertyImplicit getImplicitProperty(String modId, String uniqueName); - - IPipePropertyImplicit registerSimpleImplicitProperty(String name, Class typeClass); - - IPipePropertyImplicit registerCutomImplicitProperty(String name, IPipePropertyImplicit property); - - // Used in case BuildCraft is not installed - enum Void implements IPropertyRegistry { - INSTANCE; - - // @formatter:off - @Override - public IPipePropertyValue getValueProperty(String a, String b) { - return null; - } - - @Override - public IPipePropertyValue registerValueProperty(String a, Class b) { - return null; - } - - @Override - public IPipePropertyImplicit getImplicitProperty(String a, String b) { - return null; - } - - @Override - public IPipePropertyImplicit registerSimpleImplicitProperty(String a, Class b) { - return null; - } - - @Override - public IPipePropertyImplicit registerCutomImplicitProperty(String a, IPipePropertyImplicit p) { - return p; - } - // @formatter:on - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeAPI_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeAPI_BC8.java deleted file mode 100644 index 80030d459..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeAPI_BC8.java +++ /dev/null @@ -1,58 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.item.EnumDyeColor; - -import buildcraft.api.APIHelper; -import buildcraft.api.transport.pipe_bc8.IExtractionManager.IExtractable_BC8; -import buildcraft.api.transport.pipe_bc8.IInsertionManager.IInsertable_BC8; -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyImplicit; -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyValue; - -public enum PipeAPI_BC8 { - INSTANCE; - - public static final IPropertyRegistry PROPERTY_REGISTRY; - /** An insertion manager- used to get an instance of {@link IInsertable_BC8} for a given tile entity or movable - * entity. Can also be used to register custom {@link IInsertable_BC8} for custom tiles. */ - public static final IInsertionManager INSERTION_MANAGER; - /** An extraction manager- used to get an instance of {@link IExtractable_BC8} for a given tile entity or movable - * entity. Can also be used to register custom {@link IExtractable_BC8} for custom entities. */ - public static final IExtractionManager EXTRACTION_MANAGER; - - public static final IPipeRegistry PIPE_REGISTRY; - public static final IPipeListenerRegistry PIPE_LISTENER_REGISTRY; - - public static final IPipeHelper PIPE_HELPER; - - public static final IPipeType PIPE_TYPE_STRUCTURE; - public static final IPipeType PIPE_TYPE_POWER; - public static final IPipeType PIPE_TYPE_FLUID; - public static final IPipeType PIPE_TYPE_ITEM; - - public static final IPipePropertyValue ITEM_COLOUR; - public static final IPipePropertyValue ITEM_PAUSED; - - public static final IPipePropertyImplicit ITEM_COUNT; - public static final IPipePropertyImplicit STACK_COUNT; - - static { - PROPERTY_REGISTRY = APIHelper.getInstance("buildcraft.transport.api.impl.PropertyRegistry", IPropertyRegistry.class); - INSERTION_MANAGER = APIHelper.getInstance("buildcraft.transport.api.impl.InsertionManager", IInsertionManager.class); - EXTRACTION_MANAGER = APIHelper.getInstance("buildcraft.transport.api.impl.ExtractionManager", IExtractionManager.class); - - PIPE_REGISTRY = APIHelper.getInstance("buildcraft.transport.api.impl.PipeRegistry", IPipeRegistry.class); - PIPE_LISTENER_REGISTRY = APIHelper.getInstance("buildcraft.transport.api.impl.PipeListenerRegistry", IPipeListenerRegistry.class); - PIPE_HELPER = APIHelper.getInstance("buildcraft.transport.api.impl.PipeHelper", IPipeHelper.class); - - PIPE_TYPE_STRUCTURE = APIHelper.getNamedInstance("buildcraft.transport.api.impl.EnumPipeType", "STRUCTURE", IPipeType.class); - PIPE_TYPE_POWER = APIHelper.getNamedInstance("buildcraft.transport.api.impl.EnumPipeType", "POWER", IPipeType.class); - PIPE_TYPE_FLUID = APIHelper.getNamedInstance("buildcraft.transport.api.impl.EnumPipeType", "FLUID", IPipeType.class); - PIPE_TYPE_ITEM = APIHelper.getNamedInstance("buildcraft.transport.api.impl.EnumPipeType", "ITEM", IPipeType.class); - - ITEM_COLOUR = PROPERTY_REGISTRY.getValueProperty("BuildCraft|Transport", "item_colour"); - ITEM_PAUSED = PROPERTY_REGISTRY.getValueProperty("BuildCraft|Transport", "item_paused"); - - ITEM_COUNT = PROPERTY_REGISTRY.getImplicitProperty("BuildCraft|Transport", "item_count"); - STACK_COUNT = PROPERTY_REGISTRY.getImplicitProperty("BuildCraft|Transport", "stack_count"); - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeBehaviour_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeBehaviour_BC8.java deleted file mode 100644 index 41daf25fb..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeBehaviour_BC8.java +++ /dev/null @@ -1,35 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.nbt.NBTBase; -import net.minecraft.util.EnumFacing; - -import io.netty.buffer.ByteBuf; - -/** An instance is created by instance of IBehaviourFactory per pipe block in world, and is registered with the pipe - * event bus to listen and respond to events. */ -public abstract class PipeBehaviour_BC8 implements IPipeListener { - public final PipeDefinition_BC8 definition; - public final IPipe_BC8 pipe; - - public PipeBehaviour_BC8(PipeDefinition_BC8 definition, IPipe_BC8 pipe) { - if (definition == null) throw new NullPointerException("definition"); - if (pipe == null) throw new NullPointerException("pipe"); - this.definition = definition; - this.pipe = pipe; - } - - /** @param side The side of which the pipe should be registered - * @return An integer between 0 (inclusive) and definition.maxSprites (exclusive). */ - public abstract int getIconIndex(EnumFacing side); - - /** Return the index for the icon for items. Override this if getIconIndex(null) does NOT return the item icon */ - public int getIconIndexForItem() { - return getIconIndex(null); - } - - @Override - public abstract PipeBehaviour_BC8 readFromByteBuf(ByteBuf buf); - - @Override - public abstract PipeBehaviour_BC8 readFromNBT(NBTBase nbt); -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeConnectionAPI.java b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeConnectionAPI.java deleted file mode 100644 index 370f9cf1f..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeConnectionAPI.java +++ /dev/null @@ -1,46 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -import buildcraft.api.transport.ICustomPipeConnection; - -/** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you - * do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered - * version also overrides your own implementation. */ -public final class PipeConnectionAPI { - private static final Map connections = Maps.newHashMap(); - private static final ICustomPipeConnection NOTHING = new ICustomPipeConnection() { - @Override - public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state) { - return 0; - } - }; - - /** Register a block with a custom connection. Useful if you don't own the block class - * - * @param block The block instance - * @param connection The connection instance */ - public static void registerConnection(Block block, ICustomPipeConnection connection) { - connections.put(block, connection); - } - - /** Gets the current custom connection that the */ - public static ICustomPipeConnection getCustomConnection(Block block) { - ICustomPipeConnection connection = connections.get(block); - if (connection != null) { - return connection; - } - if (block instanceof ICustomPipeConnection) { - return (ICustomPipeConnection) block; - } - return NOTHING; - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeDefinition_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeDefinition_BC8.java deleted file mode 100644 index 909cf8c5a..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeDefinition_BC8.java +++ /dev/null @@ -1,86 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.util.Arrays; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.ResourceLocation; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import buildcraft.api.ObjectDefinition; -import buildcraft.api.core.BCLog; - -/** Contains all of the definitions of a pipe. */ -public final class PipeDefinition_BC8 extends ObjectDefinition { - /** The number of sprites to register related to this definition. */ - public final int maxSprites; - /** A string containing the location of the texture of a pipe. The final texture location will be - * {@link #textureLocationStart} + {@link #spriteLocations} */ - public final String textureLocationStart; - /** An array containing the end locations of each pipe texture. This array have a length equal to maxSprites. It is - * up to each indervidual pipe to determine which sprite to use for locations though. By default all of them will be - * initialised to {@link #textureLocationStart}+{@link #modUniqueTag}+{The texture suffixes given to the - * constructor} */ - private final String[] spriteLocations; - /** A factory the creates the behaviour of this definition. */ - public final IPipeBehaviourFactory behaviourFactory; - /** The type of this pipe. This determines how the pipe should be rendered and how the pipe should act. */ - public final IPipeType type; - - /** An array containing the actual sprites, where the positions are determined by {@link #spriteLocations} */ - @SideOnly(Side.CLIENT) - private TextureAtlasSprite[] sprites; - public final int itemSpriteIndex; - - public PipeDefinition_BC8(String tag, IPipeType type, String textureStart, String[] textureSuffixes, IPipeBehaviourFactory behaviour) { - this(tag, type, 0, textureStart, textureSuffixes, behaviour); - } - - /** @param tag A MOD-unique tag for the pipe - * @param type The type of pipe this is - * @param maxSprites The maximum number of sprites - * @param itemSpriteIndex - * @param textureStart - * @param factory */ - public PipeDefinition_BC8(String tag, IPipeType type, int itemSpriteIndex, String textureStart, String[] textureSuffixes, - IPipeBehaviourFactory factory) { - super(tag); - this.type = type; - this.maxSprites = textureSuffixes == null ? 1 : textureSuffixes.length; - this.itemSpriteIndex = itemSpriteIndex; - this.textureLocationStart = textureStart.endsWith("/") ? textureStart : (textureStart + "/"); - this.spriteLocations = new String[maxSprites]; - for (int i = 0; i < maxSprites; i++) { - spriteLocations[i] = textureLocationStart + modUniqueTag + (textureSuffixes == null ? "" : textureSuffixes[i]); - } - this.behaviourFactory = factory; - } - - @SideOnly(Side.CLIENT) - public TextureAtlasSprite getSprite(int index) { - if (sprites == null || index < 0 || index >= sprites.length) { - BCLog.logger.warn("Tried to get the sprite index " + index + " for " + globalUniqueTag); - return Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite(); - } - return sprites[index]; - } - - @SideOnly(Side.CLIENT) - public void registerSprites(TextureMap map) { - sprites = new TextureAtlasSprite[maxSprites]; - for (int i = 0; i < spriteLocations.length; i++) { - String string = spriteLocations[i]; - ResourceLocation location = new ResourceLocation(string); - sprites[i] = map.registerSprite(location); - } - } - - @Override - public String toString() { - return "PipeDefinition [globalUniqueTag=" + globalUniqueTag + ", modUniqueTag=" + modUniqueTag + ", behaviourFactory=" + behaviourFactory - + ", type=" + type + ", spriteLocations=" + Arrays.toString(spriteLocations) + "]"; - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventConnection_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventConnection_BC8.java deleted file mode 100644 index f03e246a8..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventConnection_BC8.java +++ /dev/null @@ -1,88 +0,0 @@ -package buildcraft.api.transport.pipe_bc8.event_bc8; - -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.transport.IPipeConnection; -import buildcraft.api.transport.pipe_bc8.IConnection_BC8; -import buildcraft.api.transport.pipe_bc8.IPipe_BC8; - -public interface IPipeEventConnection_BC8 extends IPipeEvent_BC8 { - /** @return The connection object that is used. */ - IConnection_BC8 getConnection(); - - /** @return The face that this connection is over */ - EnumFacing getFace(); - - public interface AttemptCreate extends IPipeEventConnection_BC8 { - /** Calling this will disallow ANY connection to the pipe, regardless of any previous arguments passed. */ - void disallow(); - - /** Calling this any number of times will allow the connection to the pipe, but only if {@link #disallow()} has - * not been called. If this is never called, and the connection override type is DEFAULT (As specified by - * {@link IPipeConnection}) then there will be no connection. */ - void couldAccept(); - - /** @return The connection object that will be used if this event is not blocked. */ - @Override - IConnection_BC8 getConnection(); - - Object with(); - - public interface Pipe extends AttemptCreate { - @Override - IPipe_BC8 with(); - } - - public interface Tile extends AttemptCreate { - @Override - TileEntity with(); - } - - public interface MovableEntity extends AttemptCreate { - @Override - Entity with(); - } - } - - /** Fired after the connection object has been created and bound in the pipe, such that - * {@link IPipe_BC8#getConnections()} will include {@link #getFace()} mapped to {@link #getConnection()} */ - public interface Create extends IPipeEventConnection_BC8 { - Object with(); - - public interface Pipe extends Create { - @Override - IPipe_BC8 with(); - } - - public interface Tile extends Create { - @Override - TileEntity with(); - } - - public interface MovableEntity extends Create { - @Override - Entity with(); - } - } - - public interface Destroy extends IPipeEventConnection_BC8 { - Object with(); - - public interface Pipe extends Destroy { - @Override - IPipe_BC8 with(); - } - - public interface Tile extends Destroy { - @Override - TileEntity with(); - } - - public interface MovableEntity extends Destroy { - @Override - Entity with(); - } - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventContents_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventContents_BC8.java deleted file mode 100644 index 5b0c1f894..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventContents_BC8.java +++ /dev/null @@ -1,88 +0,0 @@ -package buildcraft.api.transport.pipe_bc8.event_bc8; - -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.transport.pipe_bc8.IPipeContents; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable; -import buildcraft.api.transport.pipe_bc8.IPipe_BC8; - -/** In all events, the contents have had the appropriate variables set up as if they were in the pipe at the time the - * event is fired. */ -public interface IPipeEventContents_BC8 extends IPipeEvent_BC8 { - IPipeContents getContents(); - - // Attempts to put in some contents - - /** Checks to make sure all parts of the pipe agree to the insertion. The pipe object will automatically fire this - * if you fire an {@link Enter} event, so most of the time you dod not actually need to check this yourself. */ - public interface AttemptEnter extends IPipeEventContents_BC8 { - void disallow(); - - /** Gets the direction that the contents came from. So if this was a pipe below, and the item was moving - * upwards, this would be {@link EnumFacing#DOWN} */ - EnumFacing getFrom(); - - /** Gets the *thing* that tried to insert to this pipe. Most of the time this will be a tile entity, however it - * might be a robot or anything else an addon can think of. */ - Object getInserter(); - - public interface Pipe extends AttemptEnter { - @Override - IPipe_BC8 getInserter(); - } - - /** Fired whenever a tile entity attempts to insert an item. NOTE: this will NEVER call with a pipe as the - * argument. */ - public interface Tile extends AttemptEnter { - @Override - TileEntity getInserter(); - } - - public interface MovableEntity extends AttemptEnter { - @Override - Entity getInserter(); - } - } - - // Actually puts in the contents - - /** Fired after {@link AttemptEnter}. The contents will be added to the pipe at some time during this event, but the - * contents will NEVER change during the event interval. Also the contents will be the same object as when they have - * been added to the pipe. NOTE: The pipe object will automatically fire {@link AttemptEnter} before firing this - * event, just to check if the contents can be inserted. You do not have to manually fire {@link AttemptEnter} - * yourself. */ - public interface Enter extends IPipeEventContents_BC8 { - @Override - IPipeContentsEditable getContents(); - - /** Gets the direction that the contents came from. So if this was a pipe below, and the item was moving - * upwards, this would be {@link EnumFacing#DOWN} */ - EnumFacing getFrom(); - - /** Call this (while the event is firing) to make {@link #hasBeenHandled()} return true */ - void handle(); - - /** @return If a listener has handled the enter event. (Usually if this returns false after an event was fired - * it means that something went very wrong somewhere, and the contents has NOT been used up.) If this - * does return false you should keep the contents to yourself. */ - boolean hasBeenHandled(); - } - - /** Fired after the contents have been removed from the pipe, but before they have been dropped onto the ground or - * added to a different pipe or inventory. */ - public interface Exit extends IPipeEventContents_BC8 { - @Override - IPipeContentsEditable getContents(); - } - - public interface ChangeSpeed extends IPipeEventContents_BC8 { - /** @return the normalized speed for this contents. For items the actual speed has been multiplied by a constant - * that ensures that this returns 1 if the item is going at normal speed through a cobblestone pipe, and - * 4 if it is going at maximum speed through a gold pipe. */ - double getNormalizedSpeed(); - - void setNormalizedSpeed(double speed); - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventInteract_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventInteract_BC8.java deleted file mode 100644 index 5f73794dd..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventInteract_BC8.java +++ /dev/null @@ -1,29 +0,0 @@ -package buildcraft.api.transport.pipe_bc8.event_bc8; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; - -import buildcraft.api.tools.IToolWrench; -import buildcraft.api.transport.pipe_bc8.IPipeListener; - -public interface IPipeEventInteract_BC8 extends IPipeEvent_BC8 { - EntityPlayer getPlayer(); - - /** Fired whenever a player selects a pipe. */ - public interface Select extends IPipeEventInteract_BC8 { - /** This should be called for every {@link AxisAlignedBB} that makes up your listener, and with your listener. - * The listener will receive the actual event directly. */ - void testBB(AxisAlignedBB aabb, IPipeListener callback); - } - - public interface Activate extends IPipeEventInteract_BC8 {} - - public interface UseItem extends IPipeEventInteract_BC8 { - ItemStack getItemStack(); - } - - public interface UseWrench extends IPipeEventInteract_BC8 { - IToolWrench getWrench(); - } -} diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEvent_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEvent_BC8.java deleted file mode 100644 index 927aa34ed..000000000 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEvent_BC8.java +++ /dev/null @@ -1,26 +0,0 @@ -package buildcraft.api.transport.pipe_bc8.event_bc8; - -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyImplicit; -import buildcraft.api.transport.pipe_bc8.IPipe_BC8; - -public interface IPipeEvent_BC8 { - IPipe_BC8 getPipe(); - - public interface Tick extends IPipeEvent_BC8 { - long getCurrentTick(); - - public interface Client extends Tick {} - - public interface Server extends Tick {} - } - - public interface PropertyQuery extends IPipeEvent_BC8 { - Class getTypeClass(); - - IPipePropertyImplicit getProperty(); - - T getValue(); - - void setValue(T newValue); - } -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IConnectionMatrix.java b/src/api/java/buildcraft/api/transport/pluggable/IConnectionMatrix.java deleted file mode 100644 index 4bede4d03..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IConnectionMatrix.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.util.EnumFacing; - -public interface IConnectionMatrix { - boolean isConnected(EnumFacing face); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java b/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java deleted file mode 100644 index a3ad9f329..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java +++ /dev/null @@ -1,11 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.block.state.IBlockState; - -public interface IFacadePluggable { - IBlockState getCurrentState(); - - boolean isTransparent(); - - boolean isHollow(); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java deleted file mode 100644 index 61c69bed4..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.util.EnumFacing; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import buildcraft.api.transport.IPipe; - -@SideOnly(Side.CLIENT) -public interface IPipePluggableDynamicRenderer { - void renderDynamicPluggable(IPipe pipe, EnumFacing side, PipePluggable pipePluggable, double x, double y, double z); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java deleted file mode 100644 index b9295e5f0..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java +++ /dev/null @@ -1,10 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.transport.IPipe; - -public interface IPipePluggableItem { - PipePluggable createPipePluggable(IPipe pipe, EnumFacing side, ItemStack stack); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableState.java b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableState.java deleted file mode 100644 index 7b657dfd0..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableState.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.util.EnumFacing; - -public interface IPipePluggableState { - IConnectionMatrix getPluggableConnections(); - - PipePluggable getPluggable(EnumFacing face); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipeRenderState.java b/src/api/java/buildcraft/api/transport/pluggable/IPipeRenderState.java deleted file mode 100644 index d923061fd..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPipeRenderState.java +++ /dev/null @@ -1,5 +0,0 @@ -package buildcraft.api.transport.pluggable; - -public interface IPipeRenderState { - IConnectionMatrix getPipeConnectionMatrix(); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPluggableModelBaker.java b/src/api/java/buildcraft/api/transport/pluggable/IPluggableModelBaker.java deleted file mode 100644 index 829eedaa8..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPluggableModelBaker.java +++ /dev/null @@ -1,17 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import com.google.common.collect.ImmutableList; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.vertex.VertexFormat; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public interface IPluggableModelBaker> { - /** @return The vertex format used to generate the quads. */ - VertexFormat getVertexFormat(); - - ImmutableList bake(K key); -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java b/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java deleted file mode 100644 index 5d505904c..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java +++ /dev/null @@ -1,62 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport.pluggable; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import buildcraft.api.core.INBTStoreable; -import buildcraft.api.core.ISerializable; -import buildcraft.api.transport.IPipeTile; - -/** An IPipePluggable MUST have an empty constructor for client-side rendering! */ -public abstract class PipePluggable implements INBTStoreable, ISerializable { - public abstract ItemStack[] getDropItems(IPipeTile pipe); - - public void update(IPipeTile pipe, EnumFacing direction) { - - } - - public void onAttachedPipe(IPipeTile pipe, EnumFacing direction) { - validate(pipe, direction); - } - - public void onDetachedPipe(IPipeTile pipe, EnumFacing direction) { - invalidate(); - } - - public abstract boolean isBlocking(IPipeTile pipe, EnumFacing direction); - - public void invalidate() { - - } - - public void validate(IPipeTile pipe, EnumFacing direction) { - - } - - public boolean isSolidOnSide(IPipeTile pipe, EnumFacing direction) { - return false; - } - - public abstract AxisAlignedBB getBoundingBox(EnumFacing side); - - @SideOnly(Side.CLIENT) - public IPipePluggableDynamicRenderer getDynamicRenderer() { - return null; - } - - @SideOnly(Side.CLIENT) - public abstract PluggableModelKey getModelRenderKey(EnumWorldBlockLayer layer, EnumFacing side); - - public boolean requiresRenderUpdate(PipePluggable old) { - return true; - } -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/PluggableModelKey.java b/src/api/java/buildcraft/api/transport/pluggable/PluggableModelKey.java deleted file mode 100644 index 3094cbb22..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/PluggableModelKey.java +++ /dev/null @@ -1,45 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import java.util.Arrays; -import java.util.Objects; - -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public abstract class PluggableModelKey> { - public final EnumWorldBlockLayer layer; - public final IPluggableModelBaker baker; - public final EnumFacing side; - private final int hash; - - public PluggableModelKey(EnumWorldBlockLayer layer, IPluggableModelBaker baker, EnumFacing side) { - this.layer = layer; - if (layer != EnumWorldBlockLayer.CUTOUT && layer != EnumWorldBlockLayer.TRANSLUCENT) { - throw new IllegalArgumentException("Can only use CUTOUT or TRANSLUCENT at the moment (was " + layer + ")"); - } - if (baker == null) throw new NullPointerException("baker"); - this.baker = baker; - this.side = side; - /* Don't inclue the block layer in the hash code as there are different caches for cutout and translucent */ - this.hash = Arrays.hashCode(new int[] { System.identityHashCode(baker), Objects.hashCode(side) }); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - PluggableModelKey other = (PluggableModelKey) obj; - if (baker != other.baker) return false; - if (side != other.side) return false; - return true; - } - - @Override - public int hashCode() { - return hash; - } -} diff --git a/src/main/java/forestry/api/apiculture/IAlleleBeeSpecies.java b/src/main/java/forestry/api/apiculture/IAlleleBeeSpecies.java index d9837688f..6501d7260 100644 --- a/src/main/java/forestry/api/apiculture/IAlleleBeeSpecies.java +++ b/src/main/java/forestry/api/apiculture/IAlleleBeeSpecies.java @@ -7,7 +7,7 @@ package forestry.api.apiculture; import java.util.Map; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/forestry/api/apiculture/IBeeHousing.java b/src/main/java/forestry/api/apiculture/IBeeHousing.java index e4aa5c019..927ded844 100644 --- a/src/main/java/forestry/api/apiculture/IBeeHousing.java +++ b/src/main/java/forestry/api/apiculture/IBeeHousing.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.apiculture; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -54,5 +54,5 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource { * @since Forestry 4.2 * @return exact coordinates where bee FX should spawn from */ - Vec3 getBeeFXCoordinates(); + Vec3d getBeeFXCoordinates(); } diff --git a/src/main/java/forestry/api/apiculture/IBeeModelProvider.java b/src/main/java/forestry/api/apiculture/IBeeModelProvider.java index 31a5b6b9e..48ae440c7 100644 --- a/src/main/java/forestry/api/apiculture/IBeeModelProvider.java +++ b/src/main/java/forestry/api/apiculture/IBeeModelProvider.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.apiculture; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/forestry/api/apiculture/IBeekeepingMode.java b/src/main/java/forestry/api/apiculture/IBeekeepingMode.java index ca288dc00..4bfb4787e 100644 --- a/src/main/java/forestry/api/apiculture/IBeekeepingMode.java +++ b/src/main/java/forestry/api/apiculture/IBeekeepingMode.java @@ -7,7 +7,7 @@ package forestry.api.apiculture; import java.util.ArrayList; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IBeekeepingMode { diff --git a/src/main/java/forestry/api/apiculture/IHiveDrop.java b/src/main/java/forestry/api/apiculture/IHiveDrop.java index 3ebf22e0d..8dc56d09c 100644 --- a/src/main/java/forestry/api/apiculture/IHiveDrop.java +++ b/src/main/java/forestry/api/apiculture/IHiveDrop.java @@ -8,7 +8,7 @@ package forestry.api.apiculture; import java.util.Collection; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; /** diff --git a/src/main/java/forestry/api/apiculture/IHiveTile.java b/src/main/java/forestry/api/apiculture/IHiveTile.java index 56c28848b..0a5a8a440 100644 --- a/src/main/java/forestry/api/apiculture/IHiveTile.java +++ b/src/main/java/forestry/api/apiculture/IHiveTile.java @@ -1,7 +1,7 @@ package forestry.api.apiculture; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IHiveTile { diff --git a/src/main/java/forestry/api/apiculture/hives/IHiveDescription.java b/src/main/java/forestry/api/apiculture/hives/IHiveDescription.java index c0fdec989..a56eb23aa 100644 --- a/src/main/java/forestry/api/apiculture/hives/IHiveDescription.java +++ b/src/main/java/forestry/api/apiculture/hives/IHiveDescription.java @@ -6,7 +6,7 @@ package forestry.api.apiculture.hives; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/api/apiculture/hives/IHiveGen.java b/src/main/java/forestry/api/apiculture/hives/IHiveGen.java index 2021b71ae..5bbb13b20 100644 --- a/src/main/java/forestry/api/apiculture/hives/IHiveGen.java +++ b/src/main/java/forestry/api/apiculture/hives/IHiveGen.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.apiculture.hives; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IHiveGen { diff --git a/src/main/java/forestry/api/arboriculture/EnumFruitFamily.java b/src/main/java/forestry/api/arboriculture/EnumFruitFamily.java index 85a995d90..b57a1910e 100644 --- a/src/main/java/forestry/api/arboriculture/EnumFruitFamily.java +++ b/src/main/java/forestry/api/arboriculture/EnumFruitFamily.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.arboriculture; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IFruitFamily; @@ -37,12 +37,12 @@ public enum EnumFruitFamily implements IFruitFamily { @Override public String getName() { - return StatCollector.translateToLocal("for.family." + uid); + return I18n.translateToLocal("for.family." + uid); } @Override public String getDescription() { - return StatCollector.translateToLocal("for.family." + uid + ".description"); + return I18n.translateToLocal("for.family." + uid + ".description"); } } diff --git a/src/main/java/forestry/api/arboriculture/IAlleleLeafEffect.java b/src/main/java/forestry/api/arboriculture/IAlleleLeafEffect.java index 690322291..ff7608c8f 100644 --- a/src/main/java/forestry/api/arboriculture/IAlleleLeafEffect.java +++ b/src/main/java/forestry/api/arboriculture/IAlleleLeafEffect.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.arboriculture; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.genetics.IAlleleEffect; diff --git a/src/main/java/forestry/api/arboriculture/IAlleleTreeSpecies.java b/src/main/java/forestry/api/arboriculture/IAlleleTreeSpecies.java index db42fe336..8eb0e3e14 100644 --- a/src/main/java/forestry/api/arboriculture/IAlleleTreeSpecies.java +++ b/src/main/java/forestry/api/arboriculture/IAlleleTreeSpecies.java @@ -8,7 +8,7 @@ package forestry.api.arboriculture; import javax.annotation.Nonnull; import java.util.Collection; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.common.EnumPlantType; diff --git a/src/main/java/forestry/api/arboriculture/IFruitProvider.java b/src/main/java/forestry/api/arboriculture/IFruitProvider.java index 61b5e7156..c901c8a0c 100644 --- a/src/main/java/forestry/api/arboriculture/IFruitProvider.java +++ b/src/main/java/forestry/api/arboriculture/IFruitProvider.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.Map; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; diff --git a/src/main/java/forestry/api/arboriculture/IGermlingModelProvider.java b/src/main/java/forestry/api/arboriculture/IGermlingModelProvider.java index 0e5d3ce29..f4bbe17bf 100644 --- a/src/main/java/forestry/api/arboriculture/IGermlingModelProvider.java +++ b/src/main/java/forestry/api/arboriculture/IGermlingModelProvider.java @@ -7,7 +7,7 @@ package forestry.api.arboriculture; import javax.annotation.Nonnull; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import forestry.api.core.IModelManager; diff --git a/src/main/java/forestry/api/arboriculture/IGrowthProvider.java b/src/main/java/forestry/api/arboriculture/IGrowthProvider.java index 41dd17314..3520f34e7 100644 --- a/src/main/java/forestry/api/arboriculture/IGrowthProvider.java +++ b/src/main/java/forestry/api/arboriculture/IGrowthProvider.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.arboriculture; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IGrowthProvider { diff --git a/src/main/java/forestry/api/arboriculture/ILeafTickHandler.java b/src/main/java/forestry/api/arboriculture/ILeafTickHandler.java index a83b98746..274bcb877 100644 --- a/src/main/java/forestry/api/arboriculture/ILeafTickHandler.java +++ b/src/main/java/forestry/api/arboriculture/ILeafTickHandler.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.arboriculture; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface ILeafTickHandler { diff --git a/src/main/java/forestry/api/arboriculture/IToolGrafter.java b/src/main/java/forestry/api/arboriculture/IToolGrafter.java index 77ef7197a..d2d03eeda 100644 --- a/src/main/java/forestry/api/arboriculture/IToolGrafter.java +++ b/src/main/java/forestry/api/arboriculture/IToolGrafter.java @@ -7,7 +7,7 @@ package forestry.api.arboriculture; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IToolGrafter { diff --git a/src/main/java/forestry/api/arboriculture/ITree.java b/src/main/java/forestry/api/arboriculture/ITree.java index 9f078334a..927f1275f 100644 --- a/src/main/java/forestry/api/arboriculture/ITree.java +++ b/src/main/java/forestry/api/arboriculture/ITree.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.Map; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/forestry/api/arboriculture/ITreeGenerator.java b/src/main/java/forestry/api/arboriculture/ITreeGenerator.java index 9485b9e5a..c6eed1379 100644 --- a/src/main/java/forestry/api/arboriculture/ITreeGenerator.java +++ b/src/main/java/forestry/api/arboriculture/ITreeGenerator.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.arboriculture; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/forestry/api/arboriculture/ITreeMutation.java b/src/main/java/forestry/api/arboriculture/ITreeMutation.java index 32e68e798..a6950cd74 100644 --- a/src/main/java/forestry/api/arboriculture/ITreeMutation.java +++ b/src/main/java/forestry/api/arboriculture/ITreeMutation.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.arboriculture; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.genetics.IMutation; diff --git a/src/main/java/forestry/api/arboriculture/ITreeRoot.java b/src/main/java/forestry/api/arboriculture/ITreeRoot.java index b63f60808..1eb4be9b3 100644 --- a/src/main/java/forestry/api/arboriculture/ITreeRoot.java +++ b/src/main/java/forestry/api/arboriculture/ITreeRoot.java @@ -11,7 +11,7 @@ import java.util.Collection; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; diff --git a/src/main/java/forestry/api/core/EnumTemperature.java b/src/main/java/forestry/api/core/EnumTemperature.java index 662ea7f16..37008b9ae 100644 --- a/src/main/java/forestry/api/core/EnumTemperature.java +++ b/src/main/java/forestry/api/core/EnumTemperature.java @@ -6,7 +6,7 @@ package forestry.api.core; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/api/core/ICamouflageHandler.java b/src/main/java/forestry/api/core/ICamouflageHandler.java index 18ff0fe5c..c4e24835c 100644 --- a/src/main/java/forestry/api/core/ICamouflageHandler.java +++ b/src/main/java/forestry/api/core/ICamouflageHandler.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.core; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface ICamouflageHandler{ diff --git a/src/main/java/forestry/api/core/ICamouflagedBlock.java b/src/main/java/forestry/api/core/ICamouflagedBlock.java index ddb85d373..9020c3192 100644 --- a/src/main/java/forestry/api/core/ICamouflagedBlock.java +++ b/src/main/java/forestry/api/core/ICamouflagedBlock.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.core; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface ICamouflagedBlock { diff --git a/src/main/java/forestry/api/core/IClimateManager.java b/src/main/java/forestry/api/core/IClimateManager.java index 947acc785..a24d89d8e 100644 --- a/src/main/java/forestry/api/core/IClimateManager.java +++ b/src/main/java/forestry/api/core/IClimateManager.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.core; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IClimateManager { diff --git a/src/main/java/forestry/api/core/IModelBaker.java b/src/main/java/forestry/api/core/IModelBaker.java index 86aaffe80..cd10fc206 100644 --- a/src/main/java/forestry/api/core/IModelBaker.java +++ b/src/main/java/forestry/api/core/IModelBaker.java @@ -9,9 +9,10 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.minecraft.block.Block; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -33,17 +34,7 @@ public interface IModelBaker { void addBakedModel(@Nonnull IBakedModel model); - void addFaceXNeg(@Nonnull TextureAtlasSprite sprite); - - void addFaceYNeg(@Nonnull TextureAtlasSprite sprite); - - void addFaceZNeg(@Nonnull TextureAtlasSprite sprite); - - void addFaceYPos(@Nonnull TextureAtlasSprite sprite); - - void addFaceZPos(@Nonnull TextureAtlasSprite sprite); - - void addFaceXPos(@Nonnull TextureAtlasSprite sprite); + void addFace(@Nonnull EnumFacing facing, @Nonnull TextureAtlasSprite sprite); void setParticleSprite(@Nullable TextureAtlasSprite particleSprite); diff --git a/src/main/java/forestry/api/core/IModelBakerModel.java b/src/main/java/forestry/api/core/IModelBakerModel.java index 3f80a4893..ff030e3a1 100644 --- a/src/main/java/forestry/api/core/IModelBakerModel.java +++ b/src/main/java/forestry/api/core/IModelBakerModel.java @@ -5,14 +5,15 @@ ******************************************************************************/ package forestry.api.core; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraftforge.client.model.IFlexibleBakedModel; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public interface IModelBakerModel extends IFlexibleBakedModel { +public interface IModelBakerModel extends IBakedModel { void setGui3d(boolean gui3d); @@ -20,7 +21,7 @@ public interface IModelBakerModel extends IFlexibleBakedModel { void setParticleSprite(TextureAtlasSprite particleSprite); - void setFormat(VertexFormat formate); +// void setFormat(VertexFormat formate); void setRotation(float[] rotation); diff --git a/src/main/java/forestry/api/core/IModelManager.java b/src/main/java/forestry/api/core/IModelManager.java index 957cfa895..4d0db9598 100644 --- a/src/main/java/forestry/api/core/IModelManager.java +++ b/src/main/java/forestry/api/core/IModelManager.java @@ -6,7 +6,7 @@ package forestry.api.core; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/forestry/api/farming/DefaultFarmListener.java b/src/main/java/forestry/api/farming/DefaultFarmListener.java index 79d041015..7ee6e0a4c 100644 --- a/src/main/java/forestry/api/farming/DefaultFarmListener.java +++ b/src/main/java/forestry/api/farming/DefaultFarmListener.java @@ -8,7 +8,7 @@ package forestry.api.farming; import java.util.Collection; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; /** * Easily extendable default farmListener. diff --git a/src/main/java/forestry/api/farming/IFarmHousing.java b/src/main/java/forestry/api/farming/IFarmHousing.java index c2bd3a623..4cb8c9635 100644 --- a/src/main/java/forestry/api/farming/IFarmHousing.java +++ b/src/main/java/forestry/api/farming/IFarmHousing.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.farming; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/forestry/api/farming/IFarmListener.java b/src/main/java/forestry/api/farming/IFarmListener.java index a0cc54b2a..fbf99122f 100644 --- a/src/main/java/forestry/api/farming/IFarmListener.java +++ b/src/main/java/forestry/api/farming/IFarmListener.java @@ -8,7 +8,7 @@ package forestry.api.farming; import java.util.Collection; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public interface IFarmListener { diff --git a/src/main/java/forestry/api/farming/IFarmLogic.java b/src/main/java/forestry/api/farming/IFarmLogic.java index 49d64d752..dc881930c 100644 --- a/src/main/java/forestry/api/farming/IFarmLogic.java +++ b/src/main/java/forestry/api/farming/IFarmLogic.java @@ -8,7 +8,7 @@ package forestry.api.farming; import java.util.Collection; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/forestry/api/farming/IFarmable.java b/src/main/java/forestry/api/farming/IFarmable.java index 91f41158d..dd71d4529 100644 --- a/src/main/java/forestry/api/farming/IFarmable.java +++ b/src/main/java/forestry/api/farming/IFarmable.java @@ -7,7 +7,7 @@ package forestry.api.farming; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/main/java/forestry/api/genetics/IFlowerAcceptableRule.java b/src/main/java/forestry/api/genetics/IFlowerAcceptableRule.java index c2fedf8b6..d6c017060 100644 --- a/src/main/java/forestry/api/genetics/IFlowerAcceptableRule.java +++ b/src/main/java/forestry/api/genetics/IFlowerAcceptableRule.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.genetics; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IFlowerAcceptableRule { diff --git a/src/main/java/forestry/api/genetics/IFlowerGrowthHelper.java b/src/main/java/forestry/api/genetics/IFlowerGrowthHelper.java index fd3b6bc6b..c115c477a 100644 --- a/src/main/java/forestry/api/genetics/IFlowerGrowthHelper.java +++ b/src/main/java/forestry/api/genetics/IFlowerGrowthHelper.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.genetics; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IFlowerGrowthHelper { diff --git a/src/main/java/forestry/api/genetics/IFlowerGrowthRule.java b/src/main/java/forestry/api/genetics/IFlowerGrowthRule.java index 88b5e54ac..93f4c8145 100644 --- a/src/main/java/forestry/api/genetics/IFlowerGrowthRule.java +++ b/src/main/java/forestry/api/genetics/IFlowerGrowthRule.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.genetics; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/main/java/forestry/api/genetics/IFlowerProvider.java b/src/main/java/forestry/api/genetics/IFlowerProvider.java index 5a428a6e8..f13e2a8a9 100644 --- a/src/main/java/forestry/api/genetics/IFlowerProvider.java +++ b/src/main/java/forestry/api/genetics/IFlowerProvider.java @@ -6,7 +6,7 @@ package forestry.api.genetics; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IFlowerProvider { diff --git a/src/main/java/forestry/api/genetics/IFlowerRegistry.java b/src/main/java/forestry/api/genetics/IFlowerRegistry.java index 9ecc564e3..a6deb1d61 100644 --- a/src/main/java/forestry/api/genetics/IFlowerRegistry.java +++ b/src/main/java/forestry/api/genetics/IFlowerRegistry.java @@ -6,7 +6,7 @@ package forestry.api.genetics; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.apiculture.IBee; diff --git a/src/main/java/forestry/api/genetics/IHousing.java b/src/main/java/forestry/api/genetics/IHousing.java index b13624b97..fcf33c28f 100644 --- a/src/main/java/forestry/api/genetics/IHousing.java +++ b/src/main/java/forestry/api/genetics/IHousing.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.genetics; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; /** * Any housing, hatchery or nest with a location in the world. diff --git a/src/main/java/forestry/api/genetics/IMutationCondition.java b/src/main/java/forestry/api/genetics/IMutationCondition.java index 0267d42de..35cdac364 100644 --- a/src/main/java/forestry/api/genetics/IMutationCondition.java +++ b/src/main/java/forestry/api/genetics/IMutationCondition.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.genetics; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IMutationCondition { diff --git a/src/main/java/forestry/api/greenhouse/IGreenhouseHelper.java b/src/main/java/forestry/api/greenhouse/IGreenhouseHelper.java index 4d3ec9140..ed55ac0ff 100644 --- a/src/main/java/forestry/api/greenhouse/IGreenhouseHelper.java +++ b/src/main/java/forestry/api/greenhouse/IGreenhouseHelper.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.greenhouse; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IGreenhouseHelper { diff --git a/src/main/java/forestry/api/greenhouse/IInternalBlock.java b/src/main/java/forestry/api/greenhouse/IInternalBlock.java index 78c883010..a918c043f 100644 --- a/src/main/java/forestry/api/greenhouse/IInternalBlock.java +++ b/src/main/java/forestry/api/greenhouse/IInternalBlock.java @@ -9,7 +9,7 @@ import java.util.Collection; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IInternalBlock { diff --git a/src/main/java/forestry/api/greenhouse/IInternalBlockFace.java b/src/main/java/forestry/api/greenhouse/IInternalBlockFace.java index a30e7f2cc..2845b18aa 100644 --- a/src/main/java/forestry/api/greenhouse/IInternalBlockFace.java +++ b/src/main/java/forestry/api/greenhouse/IInternalBlockFace.java @@ -7,7 +7,7 @@ package forestry.api.greenhouse; import javax.annotation.Nonnull; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; public interface IInternalBlockFace { diff --git a/src/main/java/forestry/api/lepidopterology/IAlleleButterflyCocoon.java b/src/main/java/forestry/api/lepidopterology/IAlleleButterflyCocoon.java index ba49794b4..44d42d57d 100644 --- a/src/main/java/forestry/api/lepidopterology/IAlleleButterflyCocoon.java +++ b/src/main/java/forestry/api/lepidopterology/IAlleleButterflyCocoon.java @@ -13,7 +13,7 @@ package forestry.api.lepidopterology; import java.util.Map; import forestry.api.genetics.IAlleleProperty; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemStack; public interface IAlleleButterflyCocoon extends IAlleleProperty { diff --git a/src/main/java/forestry/api/mail/EnumTradeStationState.java b/src/main/java/forestry/api/mail/EnumTradeStationState.java index efb4d55f2..609a20bf3 100644 --- a/src/main/java/forestry/api/mail/EnumTradeStationState.java +++ b/src/main/java/forestry/api/mail/EnumTradeStationState.java @@ -7,7 +7,7 @@ package forestry.api.mail; import javax.annotation.Nonnull; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; public enum EnumTradeStationState implements IPostalState { OK("for.chat.mail.ok"), @@ -30,6 +30,6 @@ public enum EnumTradeStationState implements IPostalState { @Override public String getDescription() { - return StatCollector.translateToLocal(unlocalizedDescription); + return I18n.translateToLocal(unlocalizedDescription); } } diff --git a/src/main/java/forestry/api/multiblock/IMultiblockComponent.java b/src/main/java/forestry/api/multiblock/IMultiblockComponent.java index 6f3c10d90..42388c04c 100644 --- a/src/main/java/forestry/api/multiblock/IMultiblockComponent.java +++ b/src/main/java/forestry/api/multiblock/IMultiblockComponent.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.multiblock; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import com.mojang.authlib.GameProfile; diff --git a/src/main/java/forestry/api/multiblock/MultiblockTileEntityBase.java b/src/main/java/forestry/api/multiblock/MultiblockTileEntityBase.java index 932deee2b..646ce6c3c 100644 --- a/src/main/java/forestry/api/multiblock/MultiblockTileEntityBase.java +++ b/src/main/java/forestry/api/multiblock/MultiblockTileEntityBase.java @@ -8,9 +8,9 @@ package forestry.api.multiblock; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; /** * Base logic class for Multiblock-connected tile entities. @@ -77,11 +77,11 @@ public abstract class MultiblockTileEntityBase exten NBTTagCompound packetData = new NBTTagCompound(); multiblockLogic.encodeDescriptionPacket(packetData); this.encodeDescriptionPacket(packetData); - return new S35PacketUpdateTileEntity(getPos(), 0, packetData); + return new SPacketUpdateTileEntity(getPos(), 0, packetData); } @Override - public final void onDataPacket(NetworkManager network, S35PacketUpdateTileEntity packet) { + public final void onDataPacket(NetworkManager network, SPacketUpdateTileEntity packet) { NBTTagCompound nbtData = packet.getNbtCompound(); multiblockLogic.decodeDescriptionPacket(nbtData); this.decodeDescriptionPacket(nbtData); diff --git a/src/main/java/forestry/api/world/ITreeGenData.java b/src/main/java/forestry/api/world/ITreeGenData.java index c37eba8cf..8870e7a7c 100644 --- a/src/main/java/forestry/api/world/ITreeGenData.java +++ b/src/main/java/forestry/api/world/ITreeGenData.java @@ -5,7 +5,7 @@ ******************************************************************************/ package forestry.api.world; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/apiculture/HasFlowersCache.java b/src/main/java/forestry/apiculture/HasFlowersCache.java index 04b8bfab1..96c5af87f 100644 --- a/src/main/java/forestry/apiculture/HasFlowersCache.java +++ b/src/main/java/forestry/apiculture/HasFlowersCache.java @@ -13,7 +13,7 @@ package forestry.apiculture; import java.util.Random; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.apiculture.BeeManager; diff --git a/src/main/java/forestry/apiculture/PluginApiculture.java b/src/main/java/forestry/apiculture/PluginApiculture.java index d0e025766..09d0194bb 100644 --- a/src/main/java/forestry/apiculture/PluginApiculture.java +++ b/src/main/java/forestry/apiculture/PluginApiculture.java @@ -26,17 +26,15 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.common.BiomeDictionary; -import net.minecraftforge.common.ChestGenHooks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Property; import net.minecraftforge.fluids.FluidStack; @@ -51,7 +49,6 @@ import net.minecraftforge.oredict.OreDictionary; import forestry.Forestry; import forestry.api.apiculture.BeeManager; -import forestry.api.apiculture.EnumBeeType; import forestry.api.apiculture.FlowerManager; import forestry.api.apiculture.IBeekeepingMode; import forestry.api.apiculture.hives.HiveManager; @@ -245,7 +242,7 @@ public class PluginApiculture extends BlankForestryPlugin { defaultAccepted = Constants.EMPTY_STRINGS; } Property property = config.get("beekeeping.flowers." + flowerType, "accepted", defaultAccepted); - property.comment = acceptedFlowerMessage; + property.setComment(acceptedFlowerMessage); parseAcceptedFlowers(property.getStringList(), flowerType); String[] defaultPlantable = defaultPlantableFlowers.get(flowerType); @@ -253,7 +250,7 @@ public class PluginApiculture extends BlankForestryPlugin { defaultPlantable = Constants.EMPTY_STRINGS; } property = config.get("beekeeping.flowers." + flowerType, "plantable", defaultPlantable); - property.comment = plantableFlowerMessage; + property.setComment(plantableFlowerMessage); parsePlantableFlowers(property, flowerType); Set acceptableFlowers = flowerRegistry.getAcceptableFlowers(flowerType); @@ -330,29 +327,29 @@ public class PluginApiculture extends BlankForestryPlugin { flowerRegistry.registerAcceptableFlowerRule(new EndFlowerAcceptableRule(), FlowerManager.FlowerTypeEnd); // Register acceptable plants - flowerRegistry.registerAcceptableFlower(Blocks.dragon_egg, FlowerManager.FlowerTypeEnd); - flowerRegistry.registerAcceptableFlower(Blocks.vine, FlowerManager.FlowerTypeJungle); - flowerRegistry.registerAcceptableFlower(Blocks.tallgrass, FlowerManager.FlowerTypeJungle); - flowerRegistry.registerAcceptableFlower(Blocks.wheat, FlowerManager.FlowerTypeWheat); - flowerRegistry.registerAcceptableFlower(Blocks.pumpkin_stem, FlowerManager.FlowerTypeGourd); - flowerRegistry.registerAcceptableFlower(Blocks.melon_stem, FlowerManager.FlowerTypeGourd); - flowerRegistry.registerAcceptableFlower(Blocks.nether_wart, FlowerManager.FlowerTypeNether); - flowerRegistry.registerAcceptableFlower(Blocks.cactus, FlowerManager.FlowerTypeCacti); + flowerRegistry.registerAcceptableFlower(Blocks.DRAGON_EGG, FlowerManager.FlowerTypeEnd); + flowerRegistry.registerAcceptableFlower(Blocks.VINE, FlowerManager.FlowerTypeJungle); + flowerRegistry.registerAcceptableFlower(Blocks.TALLGRASS, FlowerManager.FlowerTypeJungle); + flowerRegistry.registerAcceptableFlower(Blocks.WHEAT, FlowerManager.FlowerTypeWheat); + flowerRegistry.registerAcceptableFlower(Blocks.PUMPKIN_STEM, FlowerManager.FlowerTypeGourd); + flowerRegistry.registerAcceptableFlower(Blocks.MELON_STEM, FlowerManager.FlowerTypeGourd); + flowerRegistry.registerAcceptableFlower(Blocks.NETHER_WART, FlowerManager.FlowerTypeNether); + flowerRegistry.registerAcceptableFlower(Blocks.CACTUS, FlowerManager.FlowerTypeCacti); - flowerRegistry.registerAcceptableFlower(Blocks.double_plant, 0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); - flowerRegistry.registerAcceptableFlower(Blocks.double_plant, 1, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); - flowerRegistry.registerAcceptableFlower(Blocks.double_plant, 4, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); - flowerRegistry.registerAcceptableFlower(Blocks.double_plant, 5, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); + flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); + flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 1, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); + flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 4, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); + flowerRegistry.registerAcceptableFlower(Blocks.DOUBLE_PLANT, 5, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); // Register plantable plants for (int meta = 0; meta <= 8; meta++) { - flowerRegistry.registerPlantableFlower(Blocks.red_flower, meta, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); + flowerRegistry.registerPlantableFlower(Blocks.RED_FLOWER, meta, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); } - flowerRegistry.registerPlantableFlower(Blocks.yellow_flower, 0, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); - flowerRegistry.registerPlantableFlower(Blocks.brown_mushroom, 0, 1.0, FlowerManager.FlowerTypeMushrooms); - flowerRegistry.registerPlantableFlower(Blocks.red_mushroom, 0, 1.0, FlowerManager.FlowerTypeMushrooms); - flowerRegistry.registerPlantableFlower(Blocks.cactus, 0, 1.0, FlowerManager.FlowerTypeCacti); + flowerRegistry.registerPlantableFlower(Blocks.YELLOW_FLOWER, 0, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow); + flowerRegistry.registerPlantableFlower(Blocks.BROWN_MUSHROOM, 0, 1.0, FlowerManager.FlowerTypeMushrooms); + flowerRegistry.registerPlantableFlower(Blocks.RED_MUSHROOM, 0, 1.0, FlowerManager.FlowerTypeMushrooms); + flowerRegistry.registerPlantableFlower(Blocks.CACTUS, 0, 1.0, FlowerManager.FlowerTypeCacti); for (String flowerType : flowerRegistry.getFlowerTypes()) { Set flowers = flowerRegistry.getAcceptableFlowers(flowerType); @@ -448,39 +445,39 @@ public class PluginApiculture extends BlankForestryPlugin { RecipeUtil.addRecipe(items.scoop, "#X#", "###", " # ", '#', "stickWood", - 'X', Blocks.wool); + 'X', Blocks.WOOL); RecipeUtil.addRecipe(items.smoker, "LS#", "LF#", "###", - '#', "ingotTin", 'S', "stickWood", 'F', Items.flint_and_steel, 'L', "leather"); - RecipeUtil.addRecipe(new ItemStack(Items.slime_ball), + '#', "ingotTin", 'S', "stickWood", 'F', Items.FLINT_AND_STEEL, 'L', "leather"); + RecipeUtil.addRecipe(new ItemStack(Items.SLIME_BALL), "#X#", "#X#", "#X#", '#', items.propolis, 'X', items.pollenCluster.get(EnumPollenCluster.NORMAL, 1)); - RecipeUtil.addRecipe(new ItemStack(Items.speckled_melon), + RecipeUtil.addRecipe(new ItemStack(Items.SPECKLED_MELON), "#X#", "#Y#", "#X#", '#', items.honeyDrop, 'X', items.honeydew, - 'Y', Items.melon); + 'Y', Items.MELON); RecipeUtil.addRecipe(items.frameUntreated, "###", "#S#", "###", '#', "stickWood", - 'S', Items.string); + 'S', Items.STRING); RecipeUtil.addRecipe(items.frameImpregnated, "###", "#S#", "###", '#', PluginCore.items.stickImpregnated, - 'S', Items.string); + 'S', Items.STRING); RecipeUtil.addRecipe(items.minecartBeehouse.getBeeHouseMinecart(), "B", "C", 'B', blocks.apiculture.get(BlockTypeApiculture.BEE_HOUSE), - 'C', Items.minecart); + 'C', Items.MINECART); RecipeUtil.addRecipe(items.minecartBeehouse.getApiaryMinecart(), "B", "C", 'B', blocks.apiculture.get(BlockTypeApiculture.APIARY), - 'C', Items.minecart); + 'C', Items.MINECART); // FOOD STUFF ItemRegistryFood foodItems = PluginFood.items; @@ -488,7 +485,7 @@ public class PluginApiculture extends BlankForestryPlugin { RecipeUtil.addRecipe(new ItemStack(foodItems.honeyedSlice, 4), "###", "#X#", "###", '#', items.honeyDrop, - 'X', Items.bread); + 'X', Items.BREAD); RecipeUtil.addRecipe(foodItems.honeyPot, "# #", " X ", "# #", @@ -523,7 +520,7 @@ public class PluginApiculture extends BlankForestryPlugin { 'Y', items.propolis); // / TORCHES - RecipeUtil.addRecipe(new ItemStack(Blocks.torch, 3), + RecipeUtil.addRecipe(new ItemStack(Blocks.TORCH, 3), " # ", " # ", " Y ", '#', PluginCore.items.beeswax, 'Y', "stickWood"); @@ -601,9 +598,9 @@ public class PluginApiculture extends BlankForestryPlugin { RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{items.honeydew.getItemStack()}, honeyDropFluid); ItemStack phosphor = PluginCore.items.phosphor.getItemStack(2); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.sand)}, Fluids.LAVA.getFluid(2000)); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.sand, 1, 1)}, Fluids.LAVA.getFluid(2000)); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.dirt)}, Fluids.LAVA.getFluid(1600)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND)}, Fluids.LAVA.getFluid(2000)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND, 1, 1)}, Fluids.LAVA.getFluid(2000)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.DIRT)}, Fluids.LAVA.getFluid(1600)); // / CARPENTER RecipeManagers.carpenterManager.addRecipe(100, Fluids.WATER.getFluid(2000), null, items.beealyzer.getItemStack(), @@ -624,7 +621,7 @@ public class PluginApiculture extends BlankForestryPlugin { "###", "###", '#', PluginCore.items.beeswax, - 'X', Items.string); + 'X', Items.STRING); RecipeManagers.carpenterManager.addRecipe(10, Fluids.WATER.getFluid(200), null, blocks.candle.getUnlitCandle(6), "#X#", '#', PluginCore.items.beeswax, @@ -642,7 +639,7 @@ public class PluginApiculture extends BlankForestryPlugin { // Cocoa combs RecipeManagers.centrifugeManager.addRecipe(20, items.beeComb.get(EnumHoneyComb.COCOA, 1), ImmutableMap.of( PluginCore.items.beeswax.getItemStack(), 1.0f, - new ItemStack(Items.dye, 1, 3), 0.5f + new ItemStack(Items.DYE, 1, 3), 0.5f )); // Simmering combs @@ -667,7 +664,7 @@ public class PluginApiculture extends BlankForestryPlugin { RecipeManagers.centrifugeManager.addRecipe(20, items.beeComb.get(EnumHoneyComb.FROZEN, 1), ImmutableMap.of( PluginCore.items.beeswax.getItemStack(), 0.8f, items.honeyDrop.getItemStack(), 0.7f, - new ItemStack(Items.snowball), 0.4f, + new ItemStack(Items.SNOWBALL), 0.4f, items.pollenCluster.get(EnumPollenCluster.CRYSTALLINE, 1), 0.2f )); @@ -697,14 +694,14 @@ public class PluginApiculture extends BlankForestryPlugin { RecipeManagers.centrifugeManager.addRecipe(20, items.beeComb.get(EnumHoneyComb.POWDERY, 1), ImmutableMap.of( items.honeyDrop.getItemStack(), 0.2f, PluginCore.items.beeswax.getItemStack(), 0.2f, - new ItemStack(Items.gunpowder), 0.9f + new ItemStack(Items.GUNPOWDER), 0.9f )); // Wheaten Combs RecipeManagers.centrifugeManager.addRecipe(20, items.beeComb.get(EnumHoneyComb.WHEATEN, 1), ImmutableMap.of( items.honeyDrop.getItemStack(), 0.2f, PluginCore.items.beeswax.getItemStack(), 0.2f, - new ItemStack(Items.wheat), 0.8f + new ItemStack(Items.WHEAT), 0.8f )); // Mossy Combs @@ -717,7 +714,7 @@ public class PluginApiculture extends BlankForestryPlugin { RecipeManagers.centrifugeManager.addRecipe(20, items.beeComb.get(EnumHoneyComb.MELLOW, 1), ImmutableMap.of( items.honeydew.getItemStack(), 0.6f, PluginCore.items.beeswax.getItemStack(), 0.2f, - new ItemStack(Items.quartz), 0.3f + new ItemStack(Items.QUARTZ), 0.3f )); // Silky Propolis @@ -815,6 +812,8 @@ public class PluginApiculture extends BlankForestryPlugin { rarity = 10; } + //TODO: Chest Loot + /* ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(BeeDefinition.STEADFAST.getMemberStack(EnumBeeType.DRONE), 1, 1, rarity)); ItemStack stack = blocks.candle.getUnlitCandle(1); @@ -833,6 +832,7 @@ public class PluginApiculture extends BlankForestryPlugin { ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(BeeDefinition.FOREST.getRainResist().getMemberStack(EnumBeeType.PRINCESS), 1, 1, 5)); ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(BeeDefinition.COMMON.getMemberStack(EnumBeeType.DRONE), 1, 2, 8)); ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(BeeDefinition.MEADOWS.getMemberStack(EnumBeeType.PRINCESS), 1, 1, 5)); + */ } private static void createHives() { @@ -911,7 +911,7 @@ public class PluginApiculture extends BlankForestryPlugin { } @Override - public void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { + public void populateChunk(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { if (Config.getBeehivesAmount() > 0.0) { HiveDecorator.decorateHives(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated); } @@ -948,9 +948,9 @@ public class PluginApiculture extends BlankForestryPlugin { public void textureHook(TextureStitchEvent.Pre event) { EntityFXSnow.sprites = new TextureAtlasSprite[3]; for (int i = 0; i < EntityFXSnow.sprites.length; i++) { - EntityFXSnow.sprites[i] = event.map.registerSprite(new ResourceLocation("forestry:entity/particles/snow." + (i + 1))); + EntityFXSnow.sprites[i] = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/snow." + (i + 1))); } - EntityFXBee.beeSprite = event.map.registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee")); + EntityFXBee.beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee")); } private static class EndFlowerAcceptableRule implements IFlowerAcceptableRule { diff --git a/src/main/java/forestry/apiculture/blocks/BlockAlveary.java b/src/main/java/forestry/apiculture/blocks/BlockAlveary.java index 26990831b..8aabf68b3 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockAlveary.java +++ b/src/main/java/forestry/apiculture/blocks/BlockAlveary.java @@ -17,16 +17,17 @@ import java.util.List; import java.util.Map; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -105,19 +106,14 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe setHardness(1.0f); setCreativeTab(Tabs.tabApiculture); setHarvestLevel("axe", 0); - setStepSound(soundTypeWood); + setSoundType(SoundType.WOOD); } @Nonnull public abstract BlockAlvearyType getAlvearyType(); - + @Override - public boolean isNormalCube() { - return true; - } - - @Override - public boolean isFullCube() { + public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { return true; } @@ -156,15 +152,15 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe } @Override - protected BlockState createBlockState() { + protected BlockStateContainer createBlockState() { BlockAlvearyType alvearyType = getAlvearyType(); if (alvearyType == BlockAlvearyType.PLAIN) { - return new BlockState(this, PLAIN_TYPE); + return new BlockStateContainer(this, PLAIN_TYPE); } else if (alvearyType.activatable) { - return new BlockState(this, STATE); + return new BlockStateContainer(this, STATE); } else { - return new BlockState(this); + return new BlockStateContainer(this); } } @@ -185,9 +181,9 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe if (!tile.getMultiblockLogic().getController().isAssembled()) { state = state.withProperty(PLAIN_TYPE, AlvearyPlainType.NORMAL); } else { - IBlockState blockStateAbove = world.getBlockState(pos.add(0, 1, 0)); + IBlockState blockStateAbove = world.getBlockState(pos.up()); Block blockAbove = blockStateAbove.getBlock(); - if (BlockUtil.isWoodSlabBlock(blockAbove, world, pos)) { + if (BlockUtil.isWoodSlabBlock(blockStateAbove, blockAbove, world, pos)) { List blocksTouching = getBlocksTouching(world, pos); switch (blocksTouching.size()) { case 3: @@ -243,7 +239,7 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { - String resourceDomain = Block.blockRegistry.getNameForObject(state.getBlock()).getResourceDomain(); + String resourceDomain = Block.REGISTRY.getNameForObject(state.getBlock()).getResourceDomain(); String resourceLocation = "apiculture/alveary_" + type; String propertyString = getPropertyString(state.getProperties()); return new ModelResourceLocation(resourceDomain + ':' + resourceLocation, propertyString); diff --git a/src/main/java/forestry/apiculture/blocks/BlockBeeHives.java b/src/main/java/forestry/apiculture/blocks/BlockBeeHives.java index b00d68f3d..ea72019ea 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockBeeHives.java +++ b/src/main/java/forestry/apiculture/blocks/BlockBeeHives.java @@ -17,15 +17,15 @@ import java.util.Random; import net.minecraft.block.BlockContainer; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -56,8 +56,8 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister, } @Override - protected BlockState createBlockState() { - return new BlockState(this, HIVE_TYPES); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, HIVE_TYPES); } @Override @@ -75,11 +75,6 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister, return new TileHive(); } - @Override - public boolean canEntityDestroy(IBlockAccess world, BlockPos pos, Entity entity) { - return false; - } - @Override public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) { super.onBlockClicked(world, pos, player); @@ -190,12 +185,12 @@ public class BlockBeeHives extends BlockContainer implements IItemModelRegister, manager.registerItemModel(item, hiveType.getMeta(), "beehives/" + hiveType.getName()); } } - + @Override - public int getRenderType() { - return 3; + public EnumBlockRenderType getRenderType(IBlockState state) { + return EnumBlockRenderType.MODEL; } - + @Override public String getNameFromMeta(int meta) { return HiveType.VALUES[meta].getName(); diff --git a/src/main/java/forestry/apiculture/blocks/BlockCandle.java b/src/main/java/forestry/apiculture/blocks/BlockCandle.java index 6c300b55b..5df29f67b 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockCandle.java +++ b/src/main/java/forestry/apiculture/blocks/BlockCandle.java @@ -23,8 +23,9 @@ import java.util.Set; import net.minecraft.block.BlockTorch; import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.SoundType; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -35,10 +36,11 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -50,6 +52,7 @@ import forestry.api.core.IItemModelRegister; import forestry.api.core.IModelManager; import forestry.api.core.Tabs; import forestry.apiculture.tiles.TileCandle; +import forestry.core.tiles.TileUtil; import forestry.core.utils.ItemStackUtil; public class BlockCandle extends BlockTorch implements IItemModelRegister, ITileEntityProvider { @@ -90,22 +93,22 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile .build(); lightingItems = new HashSet<>(Arrays.asList( - Items.flint_and_steel, - Items.flint, - Item.getItemFromBlock(Blocks.torch) + Items.FLINT_AND_STEEL, + Items.FLINT, + Item.getItemFromBlock(Blocks.TORCH) )); } public BlockCandle() { this.setHardness(0.0F); - this.setStepSound(soundTypeWood); + this.setSoundType(SoundType.WOOD); setCreativeTab(Tabs.tabApiculture); setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP).withProperty(STATE, State.OFF)); } @Override - protected BlockState createBlockState() { - return new BlockState(this, FACING, STATE); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, FACING, STATE); } @Override @@ -129,18 +132,13 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile } @Override - public int getLightValue(IBlockAccess world, BlockPos pos) { + public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof TileCandle && ((TileCandle) tileEntity).isLit()) { return 14; } return 0; } - - @Override - public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) { - return ((TileCandle) worldIn.getTileEntity(pos)).getColour(); - } @Override public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List itemList) { @@ -148,8 +146,8 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { - TileEntity tileEntity = world.getTileEntity(pos); + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { + TileEntity tileEntity = worldIn.getTileEntity(pos); if (!(tileEntity instanceof TileCandle)) { return false; } @@ -159,7 +157,6 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile boolean flag = false; boolean toggleLitState = true; - ItemStack heldItem = player.getCurrentEquippedItem(); if (!isLit) { if (heldItem == null || !lightingItems.contains(heldItem.getItem())) { @@ -186,7 +183,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile } else { boolean dyed = tryDye(heldItem, isLit, tileCandle); if (dyed) { - world.markBlockForUpdate(pos); + worldIn.markBlockRangeForRenderUpdate(pos, pos); toggleLitState = false; flag = true; } @@ -195,10 +192,10 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile if (toggleLitState) { tileCandle.setLit(!isLit); - world.markBlockForUpdate(pos); - world.theProfiler.startSection("checkLight"); - world.checkLight(pos); - world.theProfiler.endSection(); + worldIn.markBlockRangeForRenderUpdate(pos, pos); + worldIn.theProfiler.startSection("checkLight"); + worldIn.checkLight(pos); + worldIn.theProfiler.endSection(); flag = true; } return flag; @@ -252,7 +249,7 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) { + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return getCandleDrop(world, pos); } @@ -285,11 +282,10 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand) { - TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity instanceof TileCandle && ((TileCandle) tileEntity).isLit()) { - super.randomDisplayTick(world, pos, state, rand); + public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { + TileCandle tileCandle = TileUtil.getTile(worldIn, pos, TileCandle.class); + if (tileCandle != null && tileCandle.isLit()) { + super.randomDisplayTick(stateIn, worldIn, pos, rand); } } diff --git a/src/main/java/forestry/apiculture/blocks/BlockStump.java b/src/main/java/forestry/apiculture/blocks/BlockStump.java index 3f73bd9b3..46408456b 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockStump.java +++ b/src/main/java/forestry/apiculture/blocks/BlockStump.java @@ -14,13 +14,15 @@ import java.util.List; import java.util.Random; import net.minecraft.block.BlockTorch; +import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -38,7 +40,7 @@ public class BlockStump extends BlockTorch implements IItemModelRegister { public BlockStump() { this.setHardness(0.0F); - this.setStepSound(soundTypeWood); + this.setSoundType(SoundType.WOOD); setCreativeTab(Tabs.tabApiculture); } @@ -54,14 +56,12 @@ public class BlockStump extends BlockTorch implements IItemModelRegister { } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { - - ItemStack held = player.getCurrentEquippedItem(); - if (held != null && BlockCandle.lightingItems.contains(held.getItem())) { - world.setBlockState(pos, PluginApiculture.blocks.candle.getStateFromMeta(BlockUtil.getBlockMetadata(world, pos) | 0x08), Constants.FLAG_BLOCK_SYNCH); + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { + if (heldItem != null && BlockCandle.lightingItems.contains(heldItem.getItem())) { + worldIn.setBlockState(pos, PluginApiculture.blocks.candle.getStateFromMeta(BlockUtil.getBlockMetadata(worldIn, pos) | 0x08), Constants.FLAG_BLOCK_SYNCH); TileCandle tc = new TileCandle(); tc.setColour(0); // default to white - world.setTileEntity(pos, tc); + worldIn.setTileEntity(pos, tc); return true; } @@ -69,12 +69,6 @@ public class BlockStump extends BlockTorch implements IItemModelRegister { } @Override - @SideOnly(Side.CLIENT) - public int getRenderColor(IBlockState state) { - return 0xee0000; - } - - @Override - public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand) { + public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { } } diff --git a/src/main/java/forestry/apiculture/blocks/BlockTypeApicultureTesr.java b/src/main/java/forestry/apiculture/blocks/BlockTypeApicultureTesr.java index 17e755181..ade4ea812 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockTypeApicultureTesr.java +++ b/src/main/java/forestry/apiculture/blocks/BlockTypeApicultureTesr.java @@ -14,7 +14,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import forestry.apiculture.tiles.TileApiaristChest; import forestry.core.blocks.IBlockTypeTesr; diff --git a/src/main/java/forestry/apiculture/commands/CommandBeeGive.java b/src/main/java/forestry/apiculture/commands/CommandBeeGive.java index e310db144..ae2516089 100644 --- a/src/main/java/forestry/apiculture/commands/CommandBeeGive.java +++ b/src/main/java/forestry/apiculture/commands/CommandBeeGive.java @@ -15,11 +15,13 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.command.PlayerNotFoundException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; import forestry.api.apiculture.BeeManager; import forestry.api.apiculture.EnumBeeType; @@ -63,27 +65,27 @@ public class CommandBeeGive extends SubCommand { } @Override - public void processSubCommand(ICommandSender sender, String[] arguments) throws SpeciesNotFoundException, TemplateNotFoundException, PlayerNotFoundException { - if (arguments.length < 2) { - printHelp(sender); + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws SpeciesNotFoundException, TemplateNotFoundException, PlayerNotFoundException { + if (args.length < 2) { + printHelp(, sender); return; } - IBeeGenome beeGenome = getBeeGenome(arguments[0]); - EnumBeeType beeType = getBeeType(arguments[1]); + IBeeGenome beeGenome = getBeeGenome(args[0]); + EnumBeeType beeType = getBeeType(args[1]); if (beeType == null) { - printHelp(sender); + printHelp(, sender); return; } EntityPlayer player; - if (arguments.length == 3) { - player = CommandHelpers.getPlayer(sender, arguments[2]); + if (args.length == 3) { + player = CommandBase.getPlayer(server, sender, args[2]); } else { - player = CommandHelpers.getPlayer(sender, sender.getName()); + player = CommandBase.getPlayer(server, sender, sender.getName()); } if (player == null) { - printHelp(sender); + printHelp(, sender); return; } @@ -94,7 +96,7 @@ public class CommandBeeGive extends SubCommand { } ItemStack beeStack = BeeManager.beeRoot.getMemberStack(bee, beeType); - player.dropPlayerItemWithRandomChoice(beeStack, true); + player.dropItem(beeStack, false, true); CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.bee.give.given", player.getName(), bee.getGenome().getPrimary().getName(), beeType.getName()); } @@ -137,15 +139,15 @@ public class CommandBeeGive extends SubCommand { } @Override - public List addTabCompletionOptions(ICommandSender sender, String[] parameters, BlockPos pos) { - if (parameters.length == 1) { - List tabCompletion = CommandHelpers.getListOfStringsMatchingLastWord(parameters, getSpecies()); + public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { + if (args.length == 1) { + List tabCompletion = CommandHelpers.getListOfStringsMatchingLastWord(args, getSpecies()); tabCompletion.add("help"); return tabCompletion; - } else if (parameters.length == 2) { - return CommandHelpers.getListOfStringsMatchingLastWord(parameters, beeTypeArr); - } else if (parameters.length == 3) { - return CommandHelpers.getListOfStringsMatchingLastWord(parameters, CommandHelpers.getPlayers()); + } else if (args.length == 2) { + return CommandHelpers.getListOfStringsMatchingLastWord(args, beeTypeArr); + } else if (args.length == 3) { + return CommandHelpers.getListOfStringsMatchingLastWord(args, server.getPlayerList().getAllUsernames()); } return null; } diff --git a/src/main/java/forestry/apiculture/entities/AIAvoidPlayers.java b/src/main/java/forestry/apiculture/entities/AIAvoidPlayers.java index 66ec3a4b9..153ce7c6a 100644 --- a/src/main/java/forestry/apiculture/entities/AIAvoidPlayers.java +++ b/src/main/java/forestry/apiculture/entities/AIAvoidPlayers.java @@ -16,7 +16,7 @@ import net.minecraft.entity.ai.RandomPositionGenerator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.pathfinding.PathEntity; import net.minecraft.pathfinding.PathNavigate; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; public class AIAvoidPlayers extends EntityAIBase { @@ -54,8 +54,8 @@ public class AIAvoidPlayers extends EntityAIBase { return false; } - Vec3 randomTarget = RandomPositionGenerator.findRandomTargetBlockAwayFrom(mob, 16, 7, - new Vec3(player.posX, player.posY, player.posZ)); + Vec3d randomTarget = RandomPositionGenerator.findRandomTargetBlockAwayFrom(mob, 16, 7, + new Vec3d(player.posX, player.posY, player.posZ)); if (randomTarget == null) { return false; diff --git a/src/main/java/forestry/apiculture/entities/EntityFXBee.java b/src/main/java/forestry/apiculture/entities/EntityFXBee.java index 18363b8ae..08de8115b 100644 --- a/src/main/java/forestry/apiculture/entities/EntityFXBee.java +++ b/src/main/java/forestry/apiculture/entities/EntityFXBee.java @@ -11,7 +11,7 @@ package forestry.apiculture.entities; import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.Entity; import net.minecraft.world.World; @@ -24,7 +24,7 @@ public class EntityFXBee extends EntityFX { public EntityFXBee(World world, double x, double y, double z, int color) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); - setParticleIcon(beeSprite); + setParticleTexture(beeSprite); this.originX = x; this.originZ = z; @@ -35,11 +35,10 @@ public class EntityFXBee extends EntityFX { this.setSize(0.1F, 0.1F); this.particleScale *= 0.2F; this.particleMaxAge = (int) (80.0D / (Math.random() * 0.8D + 0.2D)); - this.noClip = true; - this.motionX *= 0.9D; - this.motionY *= 0.015D; - this.motionZ *= 0.9D; + this.xSpeed *= 0.9D; + this.ySpeed *= 0.015D; + this.zSpeed *= 0.9D; } /** @@ -50,54 +49,54 @@ public class EntityFXBee extends EntityFX { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.moveEntity(this.xSpeed, this.ySpeed, this.zSpeed); if (this.particleAge == this.particleMaxAge / 2) { - this.motionX = (this.originX - this.posX) * 0.04; - this.motionZ = (this.originZ - this.posZ) * 0.04; + this.xSpeed = (this.originX - this.posX) * 0.04; + this.zSpeed = (this.originZ - this.posZ) * 0.04; } if (this.particleAge < this.particleMaxAge / 4 || this.particleAge > this.particleMaxAge * 3 / 4) { - this.motionX *= 0.92 + 0.2D * rand.nextFloat(); - this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2; - this.motionZ *= 0.92 + 0.2D * rand.nextFloat(); + this.xSpeed *= 0.92 + 0.2D * rand.nextFloat(); + this.ySpeed = (this.ySpeed + 0.2 * (-0.5 + rand.nextFloat())) / 2; + this.zSpeed *= 0.92 + 0.2D * rand.nextFloat(); } else { - this.motionX *= 0.95; - this.motionY = (this.motionY + 0.2 * (-0.5 + rand.nextFloat())) / 2; - this.motionZ *= 0.95; + this.xSpeed *= 0.95; + this.ySpeed = (this.ySpeed + 0.2 * (-0.5 + rand.nextFloat())) / 2; + this.zSpeed *= 0.95; } if (this.particleAge++ >= this.particleMaxAge) { - this.setDead(); + this.setExpired(); } } @Override - public void renderParticle(WorldRenderer wR, Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { float minU = 0; float maxU = 1; float minV = 0; float maxV = 1; - if (this.particleIcon != null) { - minU = particleIcon.getMinU(); - maxU = particleIcon.getMaxU(); - minV = particleIcon.getMinV(); - maxV = particleIcon.getMaxV(); + if (this.particleTexture != null) { + minU = particleTexture.getMinU(); + maxU = particleTexture.getMaxU(); + minV = particleTexture.getMinV(); + maxV = particleTexture.getMaxV(); } float f10 = 0.1F * particleScale; - float f11 = (float) (prevPosX + (posX - prevPosX) * f - interpPosX); - float f12 = (float) (prevPosY + (posY - prevPosY) * f - interpPosY); - float f13 = (float) (prevPosZ + (posZ - prevPosZ) * f - interpPosZ); + float f11 = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX); + float f12 = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY); + float f13 = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ); - int i = this.getBrightnessForRender(f); + int i = this.getBrightnessForRender(partialTicks); int j = i >> 16 & 65535; int k = i & 65535; - wR.pos(f11 - f1 * f10 - f4 * f10, f12 - f2 * f10, f13 - f3 * f10 - f5 * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); - wR.pos(f11 - f1 * f10 + f4 * f10, f12 + f2 * f10, f13 - f3 * f10 + f5 * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); - wR.pos(f11 + f1 * f10 + f4 * f10, f12 + f2 * f10, f13 + f3 * f10 + f5 * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); - wR.pos(f11 + f1 * f10 - f4 * f10, f12 - f2 * f10, f13 + f3 * f10 - f5 * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos(f11 - rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 - rotationYZ * f10 - rotationXZ * f10).tex(maxU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos(f11 - rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 - rotationYZ * f10 + rotationXZ * f10).tex(maxU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos(f11 + rotationX * f10 + rotationXY * f10, f12 + rotationZ * f10, f13 + rotationYZ * f10 + rotationXZ * f10).tex(minU, minV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos(f11 + rotationX * f10 - rotationXY * f10, f12 - rotationZ * f10, f13 + rotationYZ * f10 - rotationXZ * f10).tex(minU, maxV).color(particleRed, particleGreen, particleBlue, 1.0F).lightmap(j, k).endVertex(); } @Override diff --git a/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java b/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java index 83b212ba0..b2aeca91f 100644 --- a/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java +++ b/src/main/java/forestry/apiculture/entities/EntityMinecartBeeHousingBase.java @@ -14,8 +14,8 @@ import java.io.IOException; import java.util.Random; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -125,8 +125,8 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain } @Override - public Vec3 getBeeFXCoordinates() { - return new Vec3(posX, posY + 0.25, posZ); + public Vec3d getBeeFXCoordinates() { + return new Vec3d(posX, posY + 0.25, posZ); } @Override diff --git a/src/main/java/forestry/apiculture/flowers/FlowerProvider.java b/src/main/java/forestry/apiculture/flowers/FlowerProvider.java index 103eeee98..f4416855a 100644 --- a/src/main/java/forestry/apiculture/flowers/FlowerProvider.java +++ b/src/main/java/forestry/apiculture/flowers/FlowerProvider.java @@ -13,7 +13,7 @@ package forestry.apiculture.flowers; import java.util.EnumSet; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; diff --git a/src/main/java/forestry/apiculture/flowers/FlowerRegistry.java b/src/main/java/forestry/apiculture/flowers/FlowerRegistry.java index 9417f4188..631b2e8eb 100644 --- a/src/main/java/forestry/apiculture/flowers/FlowerRegistry.java +++ b/src/main/java/forestry/apiculture/flowers/FlowerRegistry.java @@ -29,7 +29,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFlowerPot; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; diff --git a/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java b/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java index e00a084d6..33f2e7ca9 100644 --- a/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java +++ b/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java @@ -12,7 +12,7 @@ package forestry.apiculture.flowers; import net.minecraft.block.Block; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.genetics.IFlowerGrowthHelper; diff --git a/src/main/java/forestry/apiculture/flowers/GrowthRuleFertilize.java b/src/main/java/forestry/apiculture/flowers/GrowthRuleFertilize.java index edcf34ddc..450beb920 100644 --- a/src/main/java/forestry/apiculture/flowers/GrowthRuleFertilize.java +++ b/src/main/java/forestry/apiculture/flowers/GrowthRuleFertilize.java @@ -15,7 +15,7 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.genetics.IFlowerGrowthHelper; diff --git a/src/main/java/forestry/apiculture/flowers/GrowthRuleFlowerPot.java b/src/main/java/forestry/apiculture/flowers/GrowthRuleFlowerPot.java index 92f03dde3..3d151bc54 100644 --- a/src/main/java/forestry/apiculture/flowers/GrowthRuleFlowerPot.java +++ b/src/main/java/forestry/apiculture/flowers/GrowthRuleFlowerPot.java @@ -14,7 +14,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockFlowerPot; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityFlowerPot; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.apiculture.FlowerManager; diff --git a/src/main/java/forestry/apiculture/flowers/GrowthRuleMycelium.java b/src/main/java/forestry/apiculture/flowers/GrowthRuleMycelium.java index a8fd8b68b..e397f43b9 100644 --- a/src/main/java/forestry/apiculture/flowers/GrowthRuleMycelium.java +++ b/src/main/java/forestry/apiculture/flowers/GrowthRuleMycelium.java @@ -12,7 +12,7 @@ package forestry.apiculture.flowers; import net.minecraft.block.Block; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.genetics.IFlowerGrowthHelper; diff --git a/src/main/java/forestry/apiculture/flowers/GrowthRuleNone.java b/src/main/java/forestry/apiculture/flowers/GrowthRuleNone.java index e929ea911..7194e0ade 100644 --- a/src/main/java/forestry/apiculture/flowers/GrowthRuleNone.java +++ b/src/main/java/forestry/apiculture/flowers/GrowthRuleNone.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.apiculture.flowers; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.genetics.IFlowerGrowthHelper; diff --git a/src/main/java/forestry/apiculture/flowers/GrowthRuleSnow.java b/src/main/java/forestry/apiculture/flowers/GrowthRuleSnow.java index fb5d1c7d8..5ed756ac5 100644 --- a/src/main/java/forestry/apiculture/flowers/GrowthRuleSnow.java +++ b/src/main/java/forestry/apiculture/flowers/GrowthRuleSnow.java @@ -12,7 +12,7 @@ package forestry.apiculture.flowers; import net.minecraft.block.Block; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.genetics.IFlowerGrowthHelper; diff --git a/src/main/java/forestry/apiculture/genetics/Bee.java b/src/main/java/forestry/apiculture/genetics/Bee.java index bc372ade3..79cf0fd56 100644 --- a/src/main/java/forestry/apiculture/genetics/Bee.java +++ b/src/main/java/forestry/apiculture/genetics/Bee.java @@ -23,8 +23,8 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -342,7 +342,7 @@ public class Bee extends IndividualLiving implements IBee { } EnumTemperature temperature = EnumTemperature.getFromBiome(biome); - EnumHumidity humidity = EnumHumidity.getFromValue(biome.rainfall); + EnumHumidity humidity = EnumHumidity.getFromValue(biome.getRainfall()); return isSuitableClimate(temperature, humidity); } @@ -355,7 +355,7 @@ public class Bee extends IndividualLiving implements IBee { @Override public ArrayList getSuitableBiomes() { ArrayList suitableBiomes = new ArrayList<>(); - for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) { + for (BiomeGenBase biome : BiomeGenBase.REGISTRY) { if (isSuitableBiome(biome)) { suitableBiomes.add(biome); } @@ -377,7 +377,7 @@ public class Bee extends IndividualLiving implements IBee { IAlleleBeeSpecies primary = genome.getPrimary(); IAlleleBeeSpecies secondary = genome.getSecondary(); if (!isPureBred(EnumBeeChromosome.SPECIES)) { - list.add(EnumChatFormatting.BLUE + Translator.translateToLocal("for.bees.hybrid").replaceAll("%PRIMARY", primary.getName()).replaceAll("%SECONDARY", secondary.getName())); + list.add(TextFormatting.BLUE + Translator.translateToLocal("for.bees.hybrid").replaceAll("%PRIMARY", primary.getName()).replaceAll("%SECONDARY", secondary.getName())); } if (generation > 0) { @@ -409,8 +409,8 @@ public class Bee extends IndividualLiving implements IBee { } String lifespan = genome.getActiveAllele(EnumBeeChromosome.LIFESPAN).getName() + ' ' + Translator.translateToLocal("for.gui.life"); - String tempTolerance = EnumChatFormatting.GREEN + "T: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / " + tempToleranceAllele.getName(); - String humidTolerance = EnumChatFormatting.GREEN + "H: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / " + humidToleranceAllele.getName(); + String tempTolerance = TextFormatting.GREEN + "T: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / " + tempToleranceAllele.getName(); + String humidTolerance = TextFormatting.GREEN + "H: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / " + humidToleranceAllele.getName(); String flowers = genome.getFlowerProvider().getDescription(); list.add(lifespan); @@ -420,11 +420,11 @@ public class Bee extends IndividualLiving implements IBee { list.add(flowers); if (genome.getNeverSleeps()) { - list.add(EnumChatFormatting.RED + GenericRatings.rateActivityTime(genome.getNeverSleeps(), false)); + list.add(TextFormatting.RED + GenericRatings.rateActivityTime(genome.getNeverSleeps(), false)); } if (genome.getToleratesRain()) { - list.add(EnumChatFormatting.WHITE + Translator.translateToLocal("for.gui.flyer.tooltip")); + list.add(TextFormatting.WHITE + Translator.translateToLocal("for.gui.flyer.tooltip")); } } diff --git a/src/main/java/forestry/apiculture/genetics/BeeMutation.java b/src/main/java/forestry/apiculture/genetics/BeeMutation.java index f2b43ff92..328b8bf66 100644 --- a/src/main/java/forestry/apiculture/genetics/BeeMutation.java +++ b/src/main/java/forestry/apiculture/genetics/BeeMutation.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.apiculture.genetics; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.apiculture.BeeManager; diff --git a/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java b/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java index 1d3eab25e..e4e1290af 100755 --- a/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java +++ b/src/main/java/forestry/apiculture/genetics/BeekeepingMode.java @@ -14,7 +14,7 @@ import java.util.ArrayList; import java.util.Locale; import java.util.Random; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.apiculture.BeeManager; diff --git a/src/main/java/forestry/apiculture/genetics/DefaultBeeModelProvider.java b/src/main/java/forestry/apiculture/genetics/DefaultBeeModelProvider.java index 9864ad196..45a12af03 100644 --- a/src/main/java/forestry/apiculture/genetics/DefaultBeeModelProvider.java +++ b/src/main/java/forestry/apiculture/genetics/DefaultBeeModelProvider.java @@ -12,7 +12,7 @@ package forestry.apiculture.genetics; import java.util.Locale; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/forestry/apiculture/genetics/HiveDrop.java b/src/main/java/forestry/apiculture/genetics/HiveDrop.java index 30ce297d6..99e20df93 100755 --- a/src/main/java/forestry/apiculture/genetics/HiveDrop.java +++ b/src/main/java/forestry/apiculture/genetics/HiveDrop.java @@ -15,7 +15,7 @@ import java.util.Collections; import java.util.List; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import forestry.api.apiculture.IBee; diff --git a/src/main/java/forestry/apiculture/genetics/JubilanceRequiresResource.java b/src/main/java/forestry/apiculture/genetics/JubilanceRequiresResource.java index e5a3a7789..4c6795fa3 100644 --- a/src/main/java/forestry/apiculture/genetics/JubilanceRequiresResource.java +++ b/src/main/java/forestry/apiculture/genetics/JubilanceRequiresResource.java @@ -13,7 +13,7 @@ package forestry.apiculture.genetics; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.apiculture.IAlleleBeeSpecies; diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleBeeSpecies.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleBeeSpecies.java index a7605fdcb..e517dcf9d 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleBeeSpecies.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleBeeSpecies.java @@ -15,7 +15,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffect.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffect.java index 7442e3559..35a52f58e 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffect.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffect.java @@ -14,9 +14,9 @@ import java.util.Arrays; import java.util.List; import net.minecraft.entity.Entity; -import net.minecraft.potion.Potion; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.Vec3; +import net.minecraft.init.MobEffects; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.Vec3d; import forestry.api.apiculture.BeeManager; import forestry.api.apiculture.EnumBeeChromosome; @@ -59,8 +59,8 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB effectNone = new AlleleEffectNone("none", true), effectAggressive = new AlleleEffectAggressive(), effectHeroic = new AlleleEffectHeroic(), - effectBeatific = new AlleleEffectPotion("beatific", false, Potion.regeneration, 100), - effectMiasmic = new AlleleEffectPotion("miasmic", false, Potion.poison, 600, 100, 0.1f), + effectBeatific = new AlleleEffectPotion("beatific", false, MobEffects.REGENERATION, 100), + effectMiasmic = new AlleleEffectPotion("miasmic", false, MobEffects.POISON, 600, 100, 0.1f), effectMisanthrope = new AlleleEffectMisanthrope(), effectGlacial = new AlleleEffectGlacial(), effectRadioactive = new AlleleEffectRadioactive(), @@ -69,7 +69,7 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB effectExploration = new AlleleEffectExploration(), effectFestiveEaster = new AlleleEffectNone("festiveEaster", true), effectSnowing = new AlleleEffectSnowing(), - effectDrunkard = new AlleleEffectPotion("drunkard", false, Potion.confusion, 100), + effectDrunkard = new AlleleEffectPotion("drunkard", false, MobEffects.NAUSEA, 100), effectReanimation = new AlleleEffectResurrection("reanimation", AlleleEffectResurrection.getReanimationList()), effectResurrection = new AlleleEffectResurrection("resurrection", AlleleEffectResurrection.getResurrectionList()), effectRepulsion = new AlleleEffectRepulsion(), @@ -103,7 +103,7 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB @Override public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { - Vec3 beeFXCoordinates = housing.getBeeFXCoordinates(); + Vec3d beeFXCoordinates = housing.getBeeFXCoordinates(); Proxies.render.addBeeHiveFX(housing.getWorld(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord, beeFXCoordinates.zCoord, genome.getPrimary().getSpriteColour(0)); return storedData; } @@ -139,7 +139,7 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB Vect min = new Vect(housing.getCoordinates()).add(offset); Vect max = min.add(area); - return AxisAlignedBB.fromBounds(min.getX(), min.getY(), min.getZ(), max.getX(), max.getY(), max.getZ()); + return new AxisAlignedBB(min.getX(), min.getY(), min.getZ(), max.getX(), max.getY(), max.getZ()); } public static List getEntitiesInRange(IBeeGenome genome, IBeeHousing housing, Class entityClass) { diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectCreeper.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectCreeper.java index 9b4afe61a..9fe7854ad 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectCreeper.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectCreeper.java @@ -13,7 +13,7 @@ package forestry.apiculture.genetics.alleles; import java.util.List; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.apiculture.BeeManager; diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFertile.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFertile.java index f4590b5a9..37b057b6f 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFertile.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFertile.java @@ -14,7 +14,7 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.IGrowable; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.IPlantable; diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFungification.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFungification.java index 8471697c4..03c76f1c1 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFungification.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectFungification.java @@ -7,8 +7,8 @@ import net.minecraft.block.Block; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.passive.EntityMooshroom; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenBigMushroom; @@ -66,7 +66,7 @@ public class AlleleEffectFungification extends AlleleEffectThrottled { BlockPos pos = new BlockPos(blockX, blockY, blockZ); Block block = world.getBlockState(pos).getBlock(); if (isSuitableForMycelium(world, block, pos)) { - world.setBlockState(pos, Blocks.mycelium.getStateFromMeta(0)); + world.setBlockState(pos, Blocks.MYCELIUM.getDefaultState()); break; } else if (isSuitableForGrowth(block)) { doMushroomGrowth(block, world, pos); @@ -91,11 +91,11 @@ public class AlleleEffectFungification extends AlleleEffectThrottled { } private static boolean isSuitableForMycelium(World world, Block block, BlockPos pos) { - return block == Blocks.grass || block == Blocks.dirt && world.canBlockSeeSky(pos); + return block == Blocks.GRASS || block == Blocks.DIRT && world.canBlockSeeSky(pos); } private static boolean isSuitableForGrowth(Block block) { - return block == Blocks.red_mushroom || block == Blocks.brown_mushroom; + return block == Blocks.RED_MUSHROOM || block == Blocks.BROWN_MUSHROOM; } private static void convertCowToMooshroom(EntityCow cow) { diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectGlacial.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectGlacial.java index f279bd1bf..8b5f8b44b 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectGlacial.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectGlacial.java @@ -12,7 +12,7 @@ package forestry.apiculture.genetics.alleles; import net.minecraft.block.Block; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.apiculture.IBeeGenome; @@ -54,7 +54,7 @@ public class AlleleEffectGlacial extends AlleleEffectThrottled { // Freeze water Block block = world.getBlockState(posBlock).getBlock(); - if (block != Blocks.water) { + if (block != Blocks.WATER) { continue; } @@ -62,7 +62,7 @@ public class AlleleEffectGlacial extends AlleleEffectThrottled { continue; } - world.setBlockState(posBlock, Blocks.ice.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); + world.setBlockState(posBlock, Blocks.ice.getDefaultState(), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); } return storedData; diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectIgnition.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectIgnition.java index b660e177c..2d13e006d 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectIgnition.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectIgnition.java @@ -13,7 +13,7 @@ package forestry.apiculture.genetics.alleles; import java.util.List; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import forestry.api.apiculture.BeeManager; @@ -68,7 +68,7 @@ public class AlleleEffectIgnition extends AlleleEffectThrottled { if (housing.getWorld().rand.nextInt(2) != 0) { super.doFX(genome, storedData, housing); } else { - Vec3 beeFXCoordinates = housing.getBeeFXCoordinates(); + Vec3d beeFXCoordinates = housing.getBeeFXCoordinates(); Proxies.render.addEntityIgnitionFX(housing.getWorld(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord); } return storedData; diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectPotion.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectPotion.java index 4f08cbe59..82eac1a1d 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectPotion.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectPotion.java @@ -18,8 +18,8 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.IMob; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.potion.PotionHelper; -import net.minecraft.util.Vec3; +import net.minecraft.potion.PotionUtils; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import forestry.api.apiculture.BeeManager; @@ -41,8 +41,8 @@ public class AlleleEffectPotion extends AlleleEffectThrottled { this.duration = duration; this.chance = chance; - Collection potionEffects = Collections.singleton(new PotionEffect(potion.getId(), 1, 0)); - this.potionFXColor = PotionHelper.calcPotionLiquidColor(potionEffects); + Collection potionEffects = Collections.singleton(new PotionEffect(potion, 1, 0)); + this.potionFXColor = PotionUtils.getPotionColorFromEffectList(potionEffects); } public AlleleEffectPotion(String name, boolean isDominant, Potion potion, int duration) { @@ -78,7 +78,7 @@ public class AlleleEffectPotion extends AlleleEffectThrottled { } } - entity.addPotionEffect(new PotionEffect(potion.getId(), dur, 0)); + entity.addPotionEffect(new PotionEffect(potion, dur, 0)); } return storedData; @@ -89,7 +89,7 @@ public class AlleleEffectPotion extends AlleleEffectThrottled { if (housing.getWorld().rand.nextBoolean()) { super.doFX(genome, storedData, housing); } else { - Vec3 beeFXCoordinates = housing.getBeeFXCoordinates(); + Vec3d beeFXCoordinates = housing.getBeeFXCoordinates(); Proxies.render.addEntityPotionFX(housing.getWorld(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord, potionFXColor); } return storedData; diff --git a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectSnowing.java b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectSnowing.java index c1198df36..9dc8013f2 100644 --- a/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectSnowing.java +++ b/src/main/java/forestry/apiculture/genetics/alleles/AlleleEffectSnowing.java @@ -13,7 +13,7 @@ package forestry.apiculture.genetics.alleles; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; @@ -70,7 +70,7 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled { world.setBlockState(posBlock, block.getStateFromMeta(meta + 1), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); } } else if (block.isReplaceable(world, posBlock)) { - world.setBlockState(posBlock, Blocks.snow_layer.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); + world.setBlockState(posBlock, Blocks.snow_layer.getDefaultState(), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); } } diff --git a/src/main/java/forestry/apiculture/gui/widgets/HabitatSlot.java b/src/main/java/forestry/apiculture/gui/widgets/HabitatSlot.java index 93df93597..051fefe1c 100644 --- a/src/main/java/forestry/apiculture/gui/widgets/HabitatSlot.java +++ b/src/main/java/forestry/apiculture/gui/widgets/HabitatSlot.java @@ -70,7 +70,7 @@ public class HabitatSlot extends Widget { GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); } - Proxies.render.bindTexture(TextureMap.locationBlocksTexture); + Proxies.render.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, getIcon(), 16, 16); } } diff --git a/src/main/java/forestry/apiculture/items/HabitatLocatorLogic.java b/src/main/java/forestry/apiculture/items/HabitatLocatorLogic.java index 92c5f3c48..523441317 100644 --- a/src/main/java/forestry/apiculture/items/HabitatLocatorLogic.java +++ b/src/main/java/forestry/apiculture/items/HabitatLocatorLogic.java @@ -18,7 +18,7 @@ import java.util.Set; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/apiculture/items/ItemBeeGE.java b/src/main/java/forestry/apiculture/items/ItemBeeGE.java index 2d36f50a4..6c89e5e9b 100755 --- a/src/main/java/forestry/apiculture/items/ItemBeeGE.java +++ b/src/main/java/forestry/apiculture/items/ItemBeeGE.java @@ -12,13 +12,16 @@ package forestry.apiculture.items; import java.util.List; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.color.IItemColor; +import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -87,9 +90,9 @@ public class ItemBeeGE extends ItemGE { if (type != EnumBeeType.DRONE) { IBee individual = BeeManager.beeRoot.getMember(itemstack); if (individual.isNatural()) { - list.add(EnumChatFormatting.YELLOW + EnumChatFormatting.ITALIC.toString() + Translator.translateToLocal("for.bees.stock.pristine")); + list.add(TextFormatting.YELLOW + TextFormatting.ITALIC.toString() + Translator.translateToLocal("for.bees.stock.pristine")); } else { - list.add(EnumChatFormatting.YELLOW + Translator.translateToLocal("for.bees.stock.ignoble")); + list.add(TextFormatting.YELLOW + Translator.translateToLocal("for.bees.stock.ignoble")); } } @@ -115,21 +118,12 @@ public class ItemBeeGE extends ItemGE { } } - /* MODELS */ @SideOnly(Side.CLIENT) - @Override - public int getColorFromItemStack(ItemStack itemstack, int renderPass) { - if (!itemstack.hasTagCompound()) { - if (renderPass == 1) { - return 0xffdc16; - } else { - return 0xffffff; - } - } + public void registerItemColors() { - return getColourFromSpecies(BeeGenome.getSpecies(itemstack), renderPass); } + /* MODELS */ @SideOnly(Side.CLIENT) @Override public int getColourFromSpecies(IAlleleSpecies species, int renderPass) { diff --git a/src/main/java/forestry/apiculture/items/ItemMinecartBeehouse.java b/src/main/java/forestry/apiculture/items/ItemMinecartBeehouse.java index 6a0271bdc..9f76ec889 100644 --- a/src/main/java/forestry/apiculture/items/ItemMinecartBeehouse.java +++ b/src/main/java/forestry/apiculture/items/ItemMinecartBeehouse.java @@ -21,7 +21,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemMinecart; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/apiculture/items/ItemSmoker.java b/src/main/java/forestry/apiculture/items/ItemSmoker.java index c2315e1f8..cdfe6dc43 100644 --- a/src/main/java/forestry/apiculture/items/ItemSmoker.java +++ b/src/main/java/forestry/apiculture/items/ItemSmoker.java @@ -7,9 +7,9 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import forestry.api.apiculture.IArmorApiarist; @@ -43,10 +43,10 @@ public class ItemSmoker extends ItemForestry implements IArmorApiarist { } private static void addSmoke(World worldObj, Entity entity, int distance) { - Vec3 look = entity.getLookVec(); - Vec3 handOffset = look.crossProduct(new Vec3(0, 1, 0)); - Vec3 lookDistance = new Vec3(look.xCoord * distance, look.yCoord * distance, look.zCoord * distance); - Vec3 smokePos = lookDistance.add(entity.getPositionVector()).add(handOffset); + Vec3d look = entity.getLookVec(); + Vec3d handOffset = look.crossProduct(new Vec3d(0, 1, 0)); + Vec3d lookDistance = new Vec3d(look.xCoord * distance, look.yCoord * distance, look.zCoord * distance); + Vec3d smokePos = lookDistance.add(entity.getPositionVector()).add(handOffset); Proxies.render.addEntitySmokeFX(worldObj, smokePos.xCoord, smokePos.yCoord + 1, smokePos.zCoord); BlockPos blockPos = new BlockPos(smokePos.xCoord, smokePos.yCoord + 1, smokePos.zCoord); TileEntity tileEntity = worldObj.getTileEntity(blockPos); diff --git a/src/main/java/forestry/apiculture/multiblock/AlvearyController.java b/src/main/java/forestry/apiculture/multiblock/AlvearyController.java index 6fbb65651..79a9f23df 100644 --- a/src/main/java/forestry/apiculture/multiblock/AlvearyController.java +++ b/src/main/java/forestry/apiculture/multiblock/AlvearyController.java @@ -10,6 +10,7 @@ ******************************************************************************/ package forestry.apiculture.multiblock; +import javax.annotation.Nonnull; import java.io.IOException; import java.util.HashSet; import java.util.Set; @@ -18,8 +19,8 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -86,6 +87,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple return beekeepingLogic; } + @Nonnull @Override public IInventoryAdapter getInternalInventory() { if (isAssembled()) { @@ -330,9 +332,9 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple } @Override - public Vec3 getBeeFXCoordinates() { + public Vec3d getBeeFXCoordinates() { BlockPos coord = getCenterCoord(); - return new Vec3(coord.getX() + 0.5, coord.getY() + 1.5, coord.getZ() + 0.5); + return new Vec3d(coord.getX() + 0.5, coord.getY() + 1.5, coord.getZ() + 0.5); } @Override diff --git a/src/main/java/forestry/apiculture/multiblock/FakeAlvearyController.java b/src/main/java/forestry/apiculture/multiblock/FakeAlvearyController.java index 2f5c07634..a4d42f393 100644 --- a/src/main/java/forestry/apiculture/multiblock/FakeAlvearyController.java +++ b/src/main/java/forestry/apiculture/multiblock/FakeAlvearyController.java @@ -12,8 +12,8 @@ package forestry.apiculture.multiblock; import java.util.Collections; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.biome.BiomeGenBase; import com.mojang.authlib.GameProfile; @@ -76,7 +76,7 @@ public class FakeAlvearyController extends FakeMultiblockController implements I } @Override - public Vec3 getBeeFXCoordinates() { + public Vec3d getBeeFXCoordinates() { return null; } diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlveary.java b/src/main/java/forestry/apiculture/multiblock/TileAlveary.java index 615d7f54f..be87fea96 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlveary.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlveary.java @@ -15,8 +15,8 @@ import java.util.List; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -62,7 +62,7 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry valid = new ArrayList<>(); @@ -402,7 +409,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { } @Override - protected int func_180779_c(int villagerCount, int p_180779_2_) { + protected int chooseProfession(int villagerCount, int currentVillagerProfession) { if (villagerCount <= 0) { return Constants.ID_VILLAGER_BEEKEEPER; } else { @@ -411,14 +418,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { } private boolean isAirBlockAtCurrentPosition(World world, BlockPos pos, StructureBoundingBox box) { - return getBlockStateFromPos(world, pos.getX(), pos.getY(), pos.getZ(), box).getBlock().isAir(world, pos); + IBlockState blockStateFromPos = getBlockStateFromPos(world, pos.getX(), pos.getY(), pos.getZ(), box); + return blockStateFromPos.getBlock().isAir(blockStateFromPos, world, pos); } - - /** rotates a direction according to the way the structure is facing **/ - private EnumFacing getRotatedDirection(EnumFacing direction) { - int stairDirection = 5 - direction.ordinal(); - int meta = getMetadataWithOffset(Blocks.oak_stairs, stairDirection); - return EnumFacing.values()[5 - meta]; - } - } diff --git a/src/main/java/forestry/apiculture/worldgen/Hive.java b/src/main/java/forestry/apiculture/worldgen/Hive.java index 97f87d2fc..c2ccd0a2a 100644 --- a/src/main/java/forestry/apiculture/worldgen/Hive.java +++ b/src/main/java/forestry/apiculture/worldgen/Hive.java @@ -14,7 +14,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java b/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java index 23624157f..239dfd794 100755 --- a/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveDecorator.java @@ -16,9 +16,10 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.common.util.EnumHelper; @@ -35,7 +36,7 @@ public abstract class HiveDecorator { private static final EventType EVENT_TYPE = EnumHelper.addEnum(EventType.class, "FORESTRY_HIVES", new Class[0], new Object[0]); - public static void decorateHives(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { + public static void decorateHives(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { if (!TerrainGen.populate(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated, EVENT_TYPE)) { return; } @@ -68,7 +69,7 @@ public abstract class HiveDecorator { int worldZ = chunkZ * 16; BiomeGenBase biome = world.getBiomeGenForCoords(new BlockPos(worldX, 0, worldZ)); - EnumHumidity humidity = EnumHumidity.getFromValue(biome.rainfall); + EnumHumidity humidity = EnumHumidity.getFromValue(biome.getRainfall()); if (!hive.isGoodBiome(biome) || !hive.isGoodHumidity(humidity)) { return false; @@ -90,7 +91,7 @@ public abstract class HiveDecorator { int worldX = chunkX * 16; int worldZ = chunkZ * 16; BiomeGenBase biome = world.getBiomeGenForCoords(new BlockPos(chunkX, 0, chunkZ)); - EnumHumidity humidity = EnumHumidity.getFromValue(biome.rainfall); + EnumHumidity humidity = EnumHumidity.getFromValue(biome.getRainfall()); for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { @@ -145,7 +146,6 @@ public abstract class HiveDecorator { } hiveBlock.onBlockAdded(world, pos, state); - world.markBlockForUpdate(pos); if (!Config.generateBeehivesDebug) { hive.postGen(world, pos); diff --git a/src/main/java/forestry/apiculture/worldgen/HiveDescription.java b/src/main/java/forestry/apiculture/worldgen/HiveDescription.java index 3b07837ba..ebdf65780 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveDescription.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveDescription.java @@ -17,7 +17,7 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -71,7 +71,7 @@ public enum HiveDescription implements IHiveDescription { @Override public void postGen(World world, BlockPos pos) { if (world.isAirBlock(pos.add(0, 1, 0))) { - world.setBlockState(pos.add(0, 1, 0), Blocks.snow_layer.getStateFromMeta(0), 0); + world.setBlockState(pos.add(0, 1, 0), Blocks.snow_layer.getDefaultState(), 0); } postGenFlowers(world, pos, flowerStates); diff --git a/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java b/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java index edaf57fba..7d759ea5c 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java @@ -17,7 +17,7 @@ import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/apiculture/worldgen/HiveGen.java b/src/main/java/forestry/apiculture/worldgen/HiveGen.java index fc486b5b9..435011dac 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveGen.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveGen.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.apiculture.worldgen; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.apiculture.hives.IHiveGen; diff --git a/src/main/java/forestry/apiculture/worldgen/HiveGenGround.java b/src/main/java/forestry/apiculture/worldgen/HiveGenGround.java index e9c671339..1f577cd94 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveGenGround.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveGenGround.java @@ -15,7 +15,7 @@ import java.util.Set; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.core.utils.BlockUtil; diff --git a/src/main/java/forestry/apiculture/worldgen/HiveGenTree.java b/src/main/java/forestry/apiculture/worldgen/HiveGenTree.java index 9061532fb..808355c8a 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveGenTree.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveGenTree.java @@ -11,7 +11,7 @@ package forestry.apiculture.worldgen; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class HiveGenTree extends HiveGen { diff --git a/src/main/java/forestry/arboriculture/FruitProviderNone.java b/src/main/java/forestry/arboriculture/FruitProviderNone.java index e8be6ec98..c47c732bf 100755 --- a/src/main/java/forestry/arboriculture/FruitProviderNone.java +++ b/src/main/java/forestry/arboriculture/FruitProviderNone.java @@ -18,7 +18,7 @@ import java.util.List; import java.util.Map; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; diff --git a/src/main/java/forestry/arboriculture/FruitProviderPod.java b/src/main/java/forestry/arboriculture/FruitProviderPod.java index 527093b86..73800edf9 100755 --- a/src/main/java/forestry/arboriculture/FruitProviderPod.java +++ b/src/main/java/forestry/arboriculture/FruitProviderPod.java @@ -19,7 +19,7 @@ import java.util.Locale; import java.util.Map; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; diff --git a/src/main/java/forestry/arboriculture/FruitProviderRandom.java b/src/main/java/forestry/arboriculture/FruitProviderRandom.java index 18ddaf0c4..3ef5267bd 100755 --- a/src/main/java/forestry/arboriculture/FruitProviderRandom.java +++ b/src/main/java/forestry/arboriculture/FruitProviderRandom.java @@ -19,7 +19,7 @@ import java.util.List; import java.util.Map; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; diff --git a/src/main/java/forestry/arboriculture/FruitProviderRipening.java b/src/main/java/forestry/arboriculture/FruitProviderRipening.java index 4cbff63f8..dd4654a10 100755 --- a/src/main/java/forestry/arboriculture/FruitProviderRipening.java +++ b/src/main/java/forestry/arboriculture/FruitProviderRipening.java @@ -19,7 +19,7 @@ import java.util.List; import java.util.Map; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; diff --git a/src/main/java/forestry/arboriculture/LeafDecayHelper.java b/src/main/java/forestry/arboriculture/LeafDecayHelper.java index 6c5da7355..15ae8b6aa 100644 --- a/src/main/java/forestry/arboriculture/LeafDecayHelper.java +++ b/src/main/java/forestry/arboriculture/LeafDecayHelper.java @@ -1,9 +1,9 @@ package forestry.arboriculture; import net.minecraft.block.Block; -import net.minecraft.block.BlockLeavesBase; +import net.minecraft.block.BlockLeaves; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.core.utils.BlockUtil; @@ -15,7 +15,7 @@ public abstract class LeafDecayHelper { private static final short IS_LEAVES = -2; private static int[] leafDecayValues; - public static void leafDecay(BlockLeavesBase leaves, World world, BlockPos pos) { + public static void leafDecay(BlockLeaves leaves, World world, BlockPos pos) { if (world.isRemote) { return; } @@ -38,10 +38,11 @@ public abstract class LeafDecayHelper { for (int xOffset = -radius; xOffset <= radius; ++xOffset) { for (int yOffset = -radius; yOffset <= radius; ++yOffset) { for (int zOffset = -radius; zOffset <= radius; ++zOffset) { - Block block = BlockUtil.getBlock(world, pos.add(xOffset, yOffset, zOffset)); - - if (!block.canSustainLeaves(world, pos.add(xOffset, yOffset, zOffset))) { - if (block.isLeaves(world, pos.add(xOffset, yOffset, zOffset))) { + BlockPos blockPos = pos.add(xOffset, yOffset, zOffset); + Block block = BlockUtil.getBlock(world, blockPos); + IBlockState blockState = world.getBlockState(blockPos); + if (!block.canSustainLeaves(blockState, world, blockPos)) { + if (block.isLeaves(blockState, world, blockPos)) { leafDecayValues[(xOffset + arrayOffset) * xArrayMult + (yOffset + arrayOffset) * yArrayMult + zOffset + arrayOffset] = IS_LEAVES; } else { leafDecayValues[(xOffset + arrayOffset) * xArrayMult + (yOffset + arrayOffset) * yArrayMult + zOffset + arrayOffset] = NOT_SUSTAINS_LEAVES; diff --git a/src/main/java/forestry/arboriculture/PluginArboriculture.java b/src/main/java/forestry/arboriculture/PluginArboriculture.java index 1e3570fbc..807ee4035 100644 --- a/src/main/java/forestry/arboriculture/PluginArboriculture.java +++ b/src/main/java/forestry/arboriculture/PluginArboriculture.java @@ -19,10 +19,8 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandomChestContent; import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.common.ChestGenHooks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.IFuelHandler; import net.minecraftforge.fml.common.SidedProxy; @@ -33,7 +31,6 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.oredict.OreDictionary; -import forestry.api.arboriculture.EnumGermlingType; import forestry.api.arboriculture.EnumWoodType; import forestry.api.arboriculture.IAlleleFruit; import forestry.api.arboriculture.TreeManager; @@ -191,7 +188,7 @@ public class PluginArboriculture extends BlankForestryPlugin { for (BlockArbLog log : blocks.logs) { ItemStack logInput = new ItemStack(log, 1, OreDictionary.WILDCARD_VALUE); - ItemStack coalOutput = new ItemStack(Items.coal, 1, 1); + ItemStack coalOutput = new ItemStack(Items.COAL, 1, 1); RecipeUtil.addSmelting(logInput, coalOutput, 0.15F); } @@ -373,19 +370,19 @@ public class PluginArboriculture extends BlankForestryPlugin { } private static void registerErsatzGenomes() { - AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves, 1, 0), TreeDefinition.Oak.getIndividual()); - AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves, 1, 1), TreeDefinition.Spruce.getIndividual()); - AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves, 1, 2), TreeDefinition.Birch.getIndividual()); - AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves, 1, 3), TreeDefinition.Jungle.getIndividual()); - AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves2, 1, 0), TreeDefinition.AcaciaVanilla.getIndividual()); - AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.leaves2, 1, 1), TreeDefinition.DarkOak.getIndividual()); + AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.LEAVES, 1, 0), TreeDefinition.Oak.getIndividual()); + AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.LEAVES, 1, 1), TreeDefinition.Spruce.getIndividual()); + AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.LEAVES, 1, 2), TreeDefinition.Birch.getIndividual()); + AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.LEAVES, 1, 3), TreeDefinition.Jungle.getIndividual()); + AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.LEAVES2, 1, 0), TreeDefinition.AcaciaVanilla.getIndividual()); + AlleleManager.ersatzSpecimen.put(new ItemStack(Blocks.LEAVES2, 1, 1), TreeDefinition.DarkOak.getIndividual()); - AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 0), TreeDefinition.Oak.getIndividual()); - AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 1), TreeDefinition.Spruce.getIndividual()); - AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 2), TreeDefinition.Birch.getIndividual()); - AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 3), TreeDefinition.Jungle.getIndividual()); - AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 4), TreeDefinition.AcaciaVanilla.getIndividual()); - AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 5), TreeDefinition.DarkOak.getIndividual()); + AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.SAPLING, 1, 0), TreeDefinition.Oak.getIndividual()); + AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.SAPLING, 1, 1), TreeDefinition.Spruce.getIndividual()); + AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.SAPLING, 1, 2), TreeDefinition.Birch.getIndividual()); + AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.SAPLING, 1, 3), TreeDefinition.Jungle.getIndividual()); + AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.SAPLING, 1, 4), TreeDefinition.AcaciaVanilla.getIndividual()); + AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.SAPLING, 1, 5), TreeDefinition.DarkOak.getIndividual()); } @Override @@ -420,6 +417,8 @@ public class PluginArboriculture extends BlankForestryPlugin { } private static void registerDungeonLoot() { + // TODO: Fix chest loot + /* ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(items.grafter.getItemStack(), 1, 1, 8)); ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Oak.getMemberStack(EnumGermlingType.SAPLING), 2, 3, 6)); @@ -435,6 +434,7 @@ public class PluginArboriculture extends BlankForestryPlugin { ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Larch.getMemberStack(EnumGermlingType.POLLEN), 1, 2, 3)); ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(TreeDefinition.Lime.getMemberStack(EnumGermlingType.POLLEN), 1, 2, 3)); } + */ } private static class FuelHandler implements IFuelHandler { diff --git a/src/main/java/forestry/arboriculture/WoodHelper.java b/src/main/java/forestry/arboriculture/WoodHelper.java index 563b711d6..482505768 100644 --- a/src/main/java/forestry/arboriculture/WoodHelper.java +++ b/src/main/java/forestry/arboriculture/WoodHelper.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbDoor.java b/src/main/java/forestry/arboriculture/blocks/BlockArbDoor.java index f396abec0..02349e8f6 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbDoor.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbDoor.java @@ -19,7 +19,8 @@ import net.minecraft.block.BlockDoor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -39,7 +40,7 @@ public class BlockArbDoor extends BlockDoor implements IWoodTyped, IItemModelReg private final EnumWoodType woodType; public BlockArbDoor(EnumWoodType woodType) { - super(Material.wood); + super(Material.WOOD); this.woodType = woodType; setHarvestLevel("axe", 0); @@ -81,8 +82,7 @@ public class BlockArbDoor extends BlockDoor implements IWoodTyped, IItemModelReg } @Override - public float getBlockHardness(World world, BlockPos pos) { - IBlockState blockState = world.getBlockState(pos); + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { int meta = getMetaFromState(blockState); EnumWoodType woodType = getWoodType(meta); return woodType.getHardness(); @@ -98,8 +98,8 @@ public class BlockArbDoor extends BlockDoor implements IWoodTyped, IItemModelReg @Override @SideOnly(Side.CLIENT) - public Item getItem(World worldIn, BlockPos pos) { - return getItem(); + public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { + return new ItemStack(getItem()); } private Item getItem() { diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbFence.java b/src/main/java/forestry/arboriculture/blocks/BlockArbFence.java index f59a00279..d7cdfbbc2 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbFence.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbFence.java @@ -18,15 +18,18 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -71,7 +74,7 @@ public abstract class BlockArbFence extends BlockFence implements IWoodTyped, II private final int blockNumber; public BlockArbFence(boolean fireproof, int blockNumber) { - super(Material.wood); + super(Material.WOOD, BlockPlanks.EnumType.OAK.getMapColor()); this.fireproof = fireproof; this.blockNumber = blockNumber; @@ -87,7 +90,7 @@ public abstract class BlockArbFence extends BlockFence implements IWoodTyped, II setHardness(2.0F); setResistance(5.0F); setHarvestLevel("axe", 0); - setStepSound(soundTypeWood); + setSoundType(SoundType.WOOD); setCreativeTab(Tabs.tabArboriculture); } @@ -104,13 +107,20 @@ public abstract class BlockArbFence extends BlockFence implements IWoodTyped, II } @Override - public boolean canConnectTo(IBlockAccess world, BlockPos pos) { - Block block = world.getBlockState(pos).getBlock(); + public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) { + IBlockState blockState = worldIn.getBlockState(pos); + Block block = blockState.getBlock(); if (PluginArboriculture.validFences.contains(block) || block instanceof BlockFence || block instanceof BlockFenceGate) { return true; } - return block.getMaterial().isOpaque() && block.isNormalCube() && block.getMaterial() != Material.gourd; + if (block != Blocks.BARRIER) { + Material blockMaterial = block.getMaterial(blockState); + if (blockMaterial.isOpaque() && blockState.isFullCube() && blockMaterial != Material.GOURD) { + return true; + } + } + return false; } /* Models */ @@ -120,10 +130,9 @@ public abstract class BlockArbFence extends BlockFence implements IWoodTyped, II manager.registerVariant(item, WoodHelper.getResourceLocations(this)); manager.registerItemModel(item, new WoodMeshDefinition(this)); } - + @Override - public float getBlockHardness(World world, BlockPos pos) { - IBlockState blockState = world.getBlockState(pos); + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { int meta = getMetaFromState(blockState); EnumWoodType woodType = getWoodType(meta); return woodType.getHardness(); @@ -176,8 +185,8 @@ public abstract class BlockArbFence extends BlockFence implements IWoodTyped, II } @Override - protected BlockState createBlockState() { - return new BlockState(this, NORTH, EAST, WEST, SOUTH, getVariant()); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, NORTH, EAST, WEST, SOUTH, getVariant()); } @Override diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbFenceGate.java b/src/main/java/forestry/arboriculture/blocks/BlockArbFenceGate.java index a560e9cab..c38cfdc4d 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbFenceGate.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbFenceGate.java @@ -31,7 +31,7 @@ import net.minecraft.block.BlockPlanks.EnumType; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.relauncher.Side; @@ -49,7 +49,7 @@ public class BlockArbFenceGate extends BlockFenceGate implements IWoodTyped, IIt setHardness(2.0F); setResistance(5.0F); - setStepSound(soundTypeWood); + setSoundType(SoundType.WOOD); setCreativeTab(Tabs.tabArboriculture); } diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbLog.java b/src/main/java/forestry/arboriculture/blocks/BlockArbLog.java index c7d37d6fe..732a00b67 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbLog.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbLog.java @@ -16,15 +16,14 @@ import java.util.Collection; import java.util.List; import net.minecraft.block.BlockLog; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -148,8 +147,8 @@ public abstract class BlockArbLog extends BlockLog implements IWoodTyped, IState } @Override - protected BlockState createBlockState() { - return new BlockState(this, getVariant(), LOG_AXIS); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, getVariant(), LOG_AXIS); } @Override @@ -186,8 +185,7 @@ public abstract class BlockArbLog extends BlockLog implements IWoodTyped, IState } @Override - public float getBlockHardness(World world, BlockPos pos) { - IBlockState blockState = world.getBlockState(pos); + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { int meta = getMetaFromState(blockState); EnumWoodType woodType = getWoodType(meta); return woodType.getHardness(); @@ -215,28 +213,6 @@ public abstract class BlockArbLog extends BlockLog implements IWoodTyped, IState return super.getFlammability(world, pos, face); } - @Override - public boolean canSustainLeaves(IBlockAccess world, BlockPos pos) { - return true; - } - - @Override - public boolean isWood(IBlockAccess world, BlockPos pos) { - return true; - } - - @Override - public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis) { - IBlockState state = world.getBlockState(pos); - for (IProperty prop : state.getProperties().keySet()) { - if (prop.getName().equals("axis")) { - world.setBlockState(pos, state.cycleProperty(prop)); - return true; - } - } - return false; - } - @Override @SideOnly(Side.CLIENT) public void registerStateMapper() { diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbPlanks.java b/src/main/java/forestry/arboriculture/blocks/BlockArbPlanks.java index 294fb136a..5662e48ee 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbPlanks.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbPlanks.java @@ -17,14 +17,14 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -66,7 +66,7 @@ public abstract class BlockArbPlanks extends Block implements IWoodTyped, IState private final int blockNumber; private BlockArbPlanks(boolean fireproof, int blockNumber) { - super(Material.wood); + super(Material.WOOD); this.fireproof = fireproof; this.blockNumber = blockNumber; @@ -120,8 +120,8 @@ public abstract class BlockArbPlanks extends Block implements IWoodTyped, IState } @Override - protected BlockState createBlockState() { - return new BlockState(this, getVariant()); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, getVariant()); } @Override @@ -156,8 +156,7 @@ public abstract class BlockArbPlanks extends Block implements IWoodTyped, IState } @Override - public float getBlockHardness(World world, BlockPos pos) { - IBlockState blockState = world.getBlockState(pos); + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { int meta = getMetaFromState(blockState); EnumWoodType woodType = getWoodType(meta); return woodType.getHardness(); diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbSlab.java b/src/main/java/forestry/arboriculture/blocks/BlockArbSlab.java index 0e0b6d893..01696276d 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbSlab.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbSlab.java @@ -17,15 +17,16 @@ import java.util.List; import java.util.Random; import net.minecraft.block.BlockSlab; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -74,7 +75,7 @@ public abstract class BlockArbSlab extends BlockSlab implements IWoodTyped, IIte private final int blockNumber; private BlockArbSlab(boolean fireproof, int blockNumber) { - super(Material.wood); + super(Material.WOOD); this.fireproof = fireproof; this.blockNumber = blockNumber; @@ -91,7 +92,7 @@ public abstract class BlockArbSlab extends BlockSlab implements IWoodTyped, IIte setLightOpacity(0); setHardness(2.0F); setResistance(5.0F); - setStepSound(soundTypeWood); + setSoundType(SoundType.WOOD); setHarvestLevel("axe", 0); } @@ -108,8 +109,8 @@ public abstract class BlockArbSlab extends BlockSlab implements IWoodTyped, IIte } @Override - protected BlockState createBlockState() { - return this.isDouble() ? new BlockState(this, getVariant()) : new BlockState(this, HALF, getVariant()); + protected BlockStateContainer createBlockState() { + return this.isDouble() ? new BlockStateContainer(this, getVariant()) : new BlockStateContainer(this, HALF, getVariant()); } @Override @@ -155,13 +156,12 @@ public abstract class BlockArbSlab extends BlockSlab implements IWoodTyped, IIte return slab.getItem(); } + @SuppressWarnings("deprecation") // this is the way the vanilla slabs work @Override - @SideOnly(Side.CLIENT) - public Item getItem(World worldIn, BlockPos pos) { - IBlockState blockState = worldIn.getBlockState(pos); - EnumWoodType woodType = blockState.getValue(getVariant()); + public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { + EnumWoodType woodType = state.getValue(getVariant()); ItemStack slab = TreeManager.woodItemAccess.getSlab(woodType, isFireproof()); - return slab.getItem(); + return new ItemStack(slab.getItem(), 1, getMetaFromState(state)); } @SideOnly(Side.CLIENT) @@ -185,10 +185,9 @@ public abstract class BlockArbSlab extends BlockSlab implements IWoodTyped, IIte } } } - + @Override - public float getBlockHardness(World world, BlockPos pos) { - IBlockState blockState = world.getBlockState(pos); + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { int meta = getMetaFromState(blockState); EnumWoodType woodType = getWoodType(meta); return woodType.getHardness(); @@ -210,18 +209,13 @@ public abstract class BlockArbSlab extends BlockSlab implements IWoodTyped, IIte return "slab"; } - @Override - public boolean getUseNeighborBrightness() { - return true; - } - @Override public IProperty getVariantProperty() { return getVariant(); } @Override - public Object getVariant(ItemStack stack) { + public Comparable getTypeForItem(ItemStack stack) { return getWoodType(stack.getMetadata()); } diff --git a/src/main/java/forestry/arboriculture/blocks/BlockArbStairs.java b/src/main/java/forestry/arboriculture/blocks/BlockArbStairs.java index 9fbaa80ec..8cac19019 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockArbStairs.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockArbStairs.java @@ -17,7 +17,7 @@ import java.util.Collections; import net.minecraft.block.BlockStairs; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; diff --git a/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java index b117b4698..7f0f2c0ec 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockDecorativeLeaves.java @@ -6,19 +6,20 @@ import java.util.Collections; import java.util.List; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -27,8 +28,6 @@ import net.minecraftforge.common.IShearable; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import forestry.api.arboriculture.IFruitProvider; -import forestry.api.arboriculture.ITreeGenome; import forestry.api.core.IItemModelRegister; import forestry.api.core.IModelManager; import forestry.api.core.Tabs; @@ -60,10 +59,10 @@ public abstract class BlockDecorativeLeaves extends Block implements IShearable, private final int blockNumber; public BlockDecorativeLeaves(int blockNumber) { - super(Material.leaves); + super(Material.LEAVES); this.blockNumber = blockNumber; this.setCreativeTab(Tabs.tabArboriculture); - setStepSound(soundTypeGrass); + setSoundType(SoundType.PLANT); } public int getBlockNumber() { @@ -74,8 +73,8 @@ public abstract class BlockDecorativeLeaves extends Block implements IShearable, public abstract PropertyTreeType getVariant(); @Override - protected BlockState createBlockState() { - return new BlockState(this, getVariant()); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, getVariant()); } @SideOnly(Side.CLIENT) @@ -101,54 +100,40 @@ public abstract class BlockDecorativeLeaves extends Block implements IShearable, } @Override - public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) { - TreeDefinition treeDefinition = state.getValue(getVariant()); + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { + TreeDefinition treeDefinition = blockState.getValue(getVariant()); if (TreeDefinition.Willow.equals(treeDefinition)) { return null; } - return super.getCollisionBoundingBox(world, pos, state); + return super.getCollisionBoundingBox(blockState, worldIn, pos); } @Override - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entity) { - entity.motionX *= 0.4D; - entity.motionZ *= 0.4D; + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { + entityIn.motionX *= 0.4D; + entityIn.motionZ *= 0.4D; } - /* RENDERING */ @Override - public boolean isOpaqueCube() { + public boolean isOpaqueCube(IBlockState state) { return !Proxies.render.fancyGraphicsEnabled(); } - @SideOnly(Side.CLIENT) @Override - public int colorMultiplier(IBlockAccess world, BlockPos pos, int renderPass) { - IBlockState state = world.getBlockState(pos); - TreeDefinition treeDefinition = state.getValue(getVariant()); - if (treeDefinition == null) { - return super.colorMultiplier(world, pos, renderPass); - } - - ITreeGenome genome = treeDefinition.getGenome(); - - if (renderPass == 0) { - return genome.getPrimary().getLeafSpriteProvider().getColor(false); - } else { - IFruitProvider fruitProvider = genome.getFruitProvider(); - return fruitProvider.getDecorativeColor(); - } + public boolean isVisuallyOpaque() + { + return false; } @Override - public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) { - return true; + public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { + return (Proxies.render.fancyGraphicsEnabled() || blockAccess.getBlockState(pos.offset(side)).getBlock() != this) && super.shouldSideBeRendered(blockState, blockAccess, pos, side); } @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() { - return Proxies.render.fancyGraphicsEnabled() ? EnumWorldBlockLayer.CUTOUT_MIPPED : EnumWorldBlockLayer.SOLID; + public BlockRenderLayer getBlockLayer() { + return Proxies.render.fancyGraphicsEnabled() ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID; } /* MODELS */ diff --git a/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java b/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java index 2c209e9e9..c64e9582f 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockForestryLeaves.java @@ -16,35 +16,34 @@ import java.util.Collections; import java.util.List; import java.util.Random; -import net.minecraft.block.BlockLeavesBase; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockPlanks; import net.minecraft.block.IGrowable; import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Enchantments; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.common.IShearable; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; @@ -70,17 +69,13 @@ import forestry.core.blocks.propertys.UnlistedBlockAccess; import forestry.core.blocks.propertys.UnlistedBlockPos; import forestry.core.proxy.Proxies; import forestry.core.tiles.TileUtil; +import forestry.core.utils.BlockUtil; import forestry.core.utils.ItemStackUtil; -public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityProvider, IShearable, IGrowable, IItemModelRegister { +public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvider, IGrowable, IItemModelRegister { public BlockForestryLeaves() { - super(Material.leaves, false); setCreativeTab(Tabs.tabArboriculture); - setStepSound(soundTypeGrass); - setTickRandomly(true); - setHardness(0.2F); - setLightOpacity(1); } @Override @@ -90,7 +85,7 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP } @Override - protected BlockState createBlockState() { + protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{UnlistedBlockPos.POS, UnlistedBlockAccess.BLOCKACCESS}); } @@ -118,7 +113,7 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP return; } - int fortune = EnchantmentHelper.getFortuneModifier(player); + int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getActiveItemStack()); float saplingModifier = 1.0f; if (!world.isRemote) { @@ -127,7 +122,8 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP saplingModifier = ((IToolGrafter) held.getItem()).getSaplingModifier(held, world, player, pos); held.damageItem(1, player); if (held.stackSize <= 0) { - player.destroyCurrentEquippedItem(); + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, held, EnumHand.MAIN_HAND); + player.setHeldItem(EnumHand.MAIN_HAND, null); } } } @@ -180,7 +176,7 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) { + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileLeaves leaves = TileUtil.getTile(world, pos, TileLeaves.class); if (leaves == null) { return null; @@ -194,12 +190,7 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP String speciesUid = tree.getGenome().getPrimary().getUID(); return PluginArboriculture.blocks.getDecorativeLeaves(speciesUid); } - - @Override - public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos) { - return true; - } - + @Override public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { TileLeaves leaves = TileUtil.getTile(world, pos, TileLeaves.class); @@ -217,27 +208,28 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP } @Override - public void beginLeavesDecay(World world, BlockPos pos) { + public void beginLeavesDecay(IBlockState state, World world, BlockPos pos) { TileLeaves tile = TileUtil.getTile(world, pos, TileLeaves.class); if (tile == null) { return; } - super.beginLeavesDecay(world, pos); + super.beginLeavesDecay(state, world, pos); } @Override - public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) { - TileLeaves tileLeaves = TileUtil.getTile(world, pos, TileLeaves.class); + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { + TileLeaves tileLeaves = TileUtil.getTile(worldIn, pos, TileLeaves.class); if (tileLeaves != null && TreeDefinition.Willow.getUID().equals(tileLeaves.getSpeciesUID())) { return null; } - return super.getCollisionBoundingBox(world, pos, state); + return super.getCollisionBoundingBox(blockState, worldIn, pos); } @Override - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entity) { - entity.motionX *= 0.4D; - entity.motionZ *= 0.4D; + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { + super.onEntityCollidedWithBlock(worldIn, pos, state, entityIn); + entityIn.motionX *= 0.4D; + entityIn.motionZ *= 0.4D; } @Override @@ -262,41 +254,25 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP /* RENDERING */ @Override - public boolean isOpaqueCube() { + public boolean isOpaqueCube(IBlockState state) { return !Proxies.render.fancyGraphicsEnabled(); } - + @SideOnly(Side.CLIENT) @Override - public int colorMultiplier(IBlockAccess world, BlockPos pos, int renderPass) { - TileLeaves leaves = TileUtil.getTile(world, pos, TileLeaves.class); - if (leaves == null) { - return super.colorMultiplier(world, pos, renderPass); - } - - final int colour; - if (renderPass == 0) { - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - colour = leaves.getFoliageColour(thePlayer); - } else { - colour = leaves.getFruitColour(); - } - - if (colour == 0) { - return super.colorMultiplier(world, pos, renderPass); - } - return colour; + public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { + return (Proxies.render.fancyGraphicsEnabled() || blockAccess.getBlockState(pos.offset(side)).getBlock() != this) && BlockUtil.shouldSideBeRendered(blockState, blockAccess, pos, side); } - - @Override - public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) { - return true; - } - + @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() { - return Proxies.render.fancyGraphicsEnabled() ? EnumWorldBlockLayer.CUTOUT_MIPPED : EnumWorldBlockLayer.SOLID; + public BlockRenderLayer getBlockLayer() { + return Proxies.render.fancyGraphicsEnabled() ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID; + } + + @Override + public BlockPlanks.EnumType getWoodType(int meta) { + return BlockPlanks.EnumType.OAK; } /* MODELS */ @@ -326,21 +302,19 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP return 5; } } - + @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { - - ItemStack heldItem = player.getHeldItem(); - TileEntity tile = world.getTileEntity(pos); + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { + TileEntity tile = worldIn.getTileEntity(pos); IButterfly caterpillar = tile instanceof TileLeaves ? ((TileLeaves) tile).getCaterpillar() : null; if (heldItem != null && heldItem.getItem() instanceof IToolScoop && caterpillar != null) { ItemStack butterfly = ButterflyManager.butterflyRoot.getMemberStack(caterpillar, EnumFlutterType.CATERPILLAR); - ItemStackUtil.dropItemStackAsEntity(butterfly, world, pos); + ItemStackUtil.dropItemStackAsEntity(butterfly, worldIn, pos); ((TileLeaves) tile).setCaterpillar(null); return true; } - - return super.onBlockActivated(world, pos, state, player, side, hitX, hitY, hitZ); + + return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ); } /* IGrowable */ diff --git a/src/main/java/forestry/arboriculture/blocks/BlockFruitPod.java b/src/main/java/forestry/arboriculture/blocks/BlockFruitPod.java index fc264fdf6..e070b9d2b 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockFruitPod.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockFruitPod.java @@ -22,9 +22,9 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -65,7 +65,7 @@ public class BlockFruitPod extends BlockCocoa implements IStateMapperRegister, I } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) { + public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileFruitPod tile = TileUtil.getTile(world, pos, TileFruitPod.class); if (tile == null) { return null; diff --git a/src/main/java/forestry/arboriculture/blocks/BlockSapling.java b/src/main/java/forestry/arboriculture/blocks/BlockSapling.java index 7390f0137..10de76353 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockSapling.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockSapling.java @@ -16,17 +16,18 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.IGrowable; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumWorldBlockLayer; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -48,7 +49,7 @@ import forestry.core.tiles.TileUtil; import forestry.core.utils.ItemStackUtil; public class BlockSapling extends BlockTreeContainer implements IGrowable, IStateMapperRegister, IItemModelRegister { - + protected static final AxisAlignedBB SAPLING_AABB = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D); /* PROPERTYS */ public static final PropertyTree TREE = new PropertyTree("tree"); @@ -57,11 +58,14 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat } public BlockSapling() { - super(Material.plants); + super(Material.PLANTS); + setSoundType(SoundType.PLANT); + } - float factor = 0.4F; - setBlockBounds(0.5F - factor, 0.0F, 0.5F - factor, 0.5F + factor, factor * 2.0F, 0.5F + factor); - setStepSound(soundTypeGrass); + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return SAPLING_AABB; } @Override @@ -70,25 +74,27 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat } /* COLLISION BOX */ + @Override - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) { + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { return null; } /* RENDERING */ + @Override - public boolean isOpaqueCube() { + public boolean isOpaqueCube(IBlockState state) { + return false; + } + + @Override + public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { return false; } @Override - public boolean isBlockNormalCube() { - return false; - } - - @Override - public EnumWorldBlockLayer getBlockLayer() { - return EnumWorldBlockLayer.CUTOUT; + public BlockRenderLayer getBlockLayer() { + return BlockRenderLayer.CUTOUT; } /* STATES */ @@ -109,8 +115,8 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat } @Override - protected BlockState createBlockState() { - return new BlockState(this, TREE); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, TREE); } @Override @@ -128,7 +134,7 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat } /* PLANTING */ - public boolean canBlockStay(IBlockAccess world, BlockPos pos) { + public static boolean canBlockStay(IBlockAccess world, BlockPos pos) { TileSapling tile = getSaplingTile(world, pos); if (tile == null) { return false; @@ -156,18 +162,18 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { return new ArrayList<>(); } - + @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) { + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileSapling sapling = getSaplingTile(world, pos); if (sapling == null || sapling.getTree() == null) { return null; } return TreeManager.treeRoot.getMemberStack(sapling.getTree(), EnumGermlingType.SAPLING); } - + @Override - public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { if (!world.isRemote && canHarvestBlock(world, pos, player)) { if (!player.capabilities.isCreativeMode) { dropAsSapling(world, pos); diff --git a/src/main/java/forestry/arboriculture/blocks/BlockTreeContainer.java b/src/main/java/forestry/arboriculture/blocks/BlockTreeContainer.java index 03d5972ae..b081fd091 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockTreeContainer.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockTreeContainer.java @@ -16,7 +16,8 @@ import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.arboriculture.tiles.TileTreeContainer; @@ -42,10 +43,9 @@ public abstract class BlockTreeContainer extends BlockContainer { ((TileTreeContainer) tile).onBlockTick(); } - - @Override - public int getRenderType() { - return 3; - } + @Override + public EnumBlockRenderType getRenderType(IBlockState state) { + return EnumBlockRenderType.MODEL; + } } diff --git a/src/main/java/forestry/arboriculture/blocks/BlockTypeArboricultureTesr.java b/src/main/java/forestry/arboriculture/blocks/BlockTypeArboricultureTesr.java index c38914332..7dd06a7a6 100644 --- a/src/main/java/forestry/arboriculture/blocks/BlockTypeArboricultureTesr.java +++ b/src/main/java/forestry/arboriculture/blocks/BlockTypeArboricultureTesr.java @@ -14,7 +14,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import forestry.arboriculture.tiles.TileArboristChest; import forestry.core.blocks.IBlockTypeTesr; diff --git a/src/main/java/forestry/arboriculture/blocks/WoodTypeStateMapper.java b/src/main/java/forestry/arboriculture/blocks/WoodTypeStateMapper.java index b21f292b2..7b6177adf 100644 --- a/src/main/java/forestry/arboriculture/blocks/WoodTypeStateMapper.java +++ b/src/main/java/forestry/arboriculture/blocks/WoodTypeStateMapper.java @@ -12,7 +12,7 @@ import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.statemap.StateMapperBase; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -52,7 +52,7 @@ class WoodTypeStateMapper extends StateMapperBase { @Override protected ModelResourceLocation getModelResourceLocation(IBlockState state) { - final Map properties; + final Map, Comparable> properties; if (propertyWoodType != null) { properties = Maps.newLinkedHashMap(state.getProperties()); properties.remove(propertyWoodType); @@ -67,7 +67,7 @@ class WoodTypeStateMapper extends StateMapperBase { Block block = state.getBlock(); int meta = block.getMetaFromState(state); EnumWoodType woodType = woodTyped.getWoodType(meta); - String resourceDomain = Block.blockRegistry.getNameForObject(block).getResourceDomain(); + String resourceDomain = Block.REGISTRY.getNameForObject(block).getResourceDomain(); String resourceLocation = "arboriculture/" + blockPath + '/' + woodType; String propertyString = this.getPropertyString(properties); return new ModelResourceLocation(resourceDomain + ':' + resourceLocation, propertyString); diff --git a/src/main/java/forestry/arboriculture/commands/CommandTreeSpawn.java b/src/main/java/forestry/arboriculture/commands/CommandTreeSpawn.java index 9eddf3c41..eee731fbd 100644 --- a/src/main/java/forestry/arboriculture/commands/CommandTreeSpawn.java +++ b/src/main/java/forestry/arboriculture/commands/CommandTreeSpawn.java @@ -15,10 +15,12 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; +import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.command.PlayerNotFoundException; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; import forestry.api.arboriculture.IAlleleTreeSpecies; import forestry.api.genetics.AlleleManager; @@ -48,12 +50,12 @@ public final class CommandTreeSpawn extends SubCommand { EntityPlayer player; String treeName; try { - player = CommandHelpers.getPlayer(sender, arguments[arguments.length - 1]); + player = CommandBase.getPlayer((MinecraftServer) sender, (ICommandSender) arguments[arguments.length - 1], null); String[] argumentsWithoutPlayer = new String[arguments.length - 1]; System.arraycopy(arguments, 0, argumentsWithoutPlayer, 0, arguments.length - 1); treeName = StringUtils.join(argumentsWithoutPlayer, " "); } catch (PlayerNotFoundException e) { - player = CommandHelpers.getPlayer(sender, sender.getName()); + player = CommandBase.getPlayer((MinecraftServer) sender, (ICommandSender) sender.getName(), null); treeName = StringUtils.join(arguments, " "); } diff --git a/src/main/java/forestry/arboriculture/commands/ForestSpawner.java b/src/main/java/forestry/arboriculture/commands/ForestSpawner.java index ab27c0c9d..d4030b4b7 100644 --- a/src/main/java/forestry/arboriculture/commands/ForestSpawner.java +++ b/src/main/java/forestry/arboriculture/commands/ForestSpawner.java @@ -12,8 +12,8 @@ package forestry.arboriculture.commands; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.gen.feature.WorldGenerator; import forestry.core.commands.SpeciesNotFoundException; @@ -23,7 +23,7 @@ public class ForestSpawner implements ITreeSpawner { @Override public boolean spawn(ICommandSender sender, String treeName, EntityPlayer player) throws SpeciesNotFoundException, TemplateNotFoundException { - Vec3 look = player.getLookVec(); + Vec3d look = player.getLookVec(); int x = (int) Math.round(player.posX + 16 * look.xCoord); int y = (int) Math.round(player.posY); diff --git a/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java b/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java index dc265fa5b..10428444e 100644 --- a/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java +++ b/src/main/java/forestry/arboriculture/commands/TreeGenHelper.java @@ -11,7 +11,7 @@ package forestry.arboriculture.commands; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/forestry/arboriculture/commands/TreeSpawner.java b/src/main/java/forestry/arboriculture/commands/TreeSpawner.java index e89e3e9f5..733800f2e 100644 --- a/src/main/java/forestry/arboriculture/commands/TreeSpawner.java +++ b/src/main/java/forestry/arboriculture/commands/TreeSpawner.java @@ -12,8 +12,8 @@ package forestry.arboriculture.commands; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.gen.feature.WorldGenerator; import forestry.core.commands.SpeciesNotFoundException; @@ -23,7 +23,7 @@ public class TreeSpawner implements ITreeSpawner { @Override public boolean spawn(ICommandSender sender, String treeName, EntityPlayer player) throws SpeciesNotFoundException, TemplateNotFoundException { - Vec3 look = player.getLookVec(); + Vec3d look = player.getLookVec(); int x = (int) Math.round(player.posX + 3 * look.xCoord); int y = (int) Math.round(player.posY); diff --git a/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java b/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java index cb69ebd34..4e89c1435 100755 --- a/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java +++ b/src/main/java/forestry/arboriculture/genetics/GrowthProvider.java @@ -11,7 +11,7 @@ package forestry.arboriculture.genetics; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/arboriculture/genetics/GrowthProviderTropical.java b/src/main/java/forestry/arboriculture/genetics/GrowthProviderTropical.java index e7656239a..65171d5cc 100755 --- a/src/main/java/forestry/arboriculture/genetics/GrowthProviderTropical.java +++ b/src/main/java/forestry/arboriculture/genetics/GrowthProviderTropical.java @@ -12,7 +12,7 @@ package forestry.arboriculture.genetics; import java.util.EnumSet; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/arboriculture/genetics/Tree.java b/src/main/java/forestry/arboriculture/genetics/Tree.java index 028686cb4..d44c5238b 100755 --- a/src/main/java/forestry/arboriculture/genetics/Tree.java +++ b/src/main/java/forestry/arboriculture/genetics/Tree.java @@ -22,8 +22,8 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextFormatting; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -156,14 +156,17 @@ public class Tree extends Individual implements ITree, IPlantable { @Override public boolean canStay(IBlockAccess world, BlockPos pos) { - Block block = BlockUtil.getBlock(world, pos.add(0, -1, 0)); - if (block == null) { + BlockPos blockPos = pos.add(0, -1, 0); + IBlockState blockState = world.getBlockState(blockPos); + if (blockState == null) { return false; } + Block block = blockState.getBlock(); + for (EnumPlantType type : getPlantTypes()) { this.plantType = type; - if (block.canSustainPlant(world, pos.add(0, -1, 0), EnumFacing.UP, this)) { + if (block.canSustainPlant(blockState, world, blockPos, EnumFacing.UP, this)) { return true; } } @@ -288,31 +291,31 @@ public class Tree extends Individual implements ITree, IPlantable { IAlleleTreeSpecies primary = genome.getPrimary(); IAlleleTreeSpecies secondary = genome.getSecondary(); if (!isPureBred(EnumTreeChromosome.SPECIES)) { - list.add(EnumChatFormatting.BLUE + Translator.translateToLocal("for.trees.hybrid").replaceAll("%PRIMARY", primary.getName()).replaceAll("%SECONDARY", secondary.getName())); + list.add(TextFormatting.BLUE + Translator.translateToLocal("for.trees.hybrid").replaceAll("%PRIMARY", primary.getName()).replaceAll("%SECONDARY", secondary.getName())); } - String sappiness = EnumChatFormatting.GOLD + "S: " + genome.getActiveAllele(EnumTreeChromosome.SAPPINESS).getName(); - String maturation = EnumChatFormatting.RED + "M: " + genome.getActiveAllele(EnumTreeChromosome.MATURATION).getName(); - String height = EnumChatFormatting.LIGHT_PURPLE + "H: " + genome.getActiveAllele(EnumTreeChromosome.HEIGHT).getName(); - String girth = EnumChatFormatting.AQUA + "G: " + String.format("%sx%s", genome.getGirth(), genome.getGirth()); - String saplings = EnumChatFormatting.YELLOW + "S: " + genome.getActiveAllele(EnumTreeChromosome.FERTILITY).getName(); - String yield = EnumChatFormatting.WHITE + "Y: " + genome.getActiveAllele(EnumTreeChromosome.YIELD).getName(); + String sappiness = TextFormatting.GOLD + "S: " + genome.getActiveAllele(EnumTreeChromosome.SAPPINESS).getName(); + String maturation = TextFormatting.RED + "M: " + genome.getActiveAllele(EnumTreeChromosome.MATURATION).getName(); + String height = TextFormatting.LIGHT_PURPLE + "H: " + genome.getActiveAllele(EnumTreeChromosome.HEIGHT).getName(); + String girth = TextFormatting.AQUA + "G: " + String.format("%sx%s", genome.getGirth(), genome.getGirth()); + String saplings = TextFormatting.YELLOW + "S: " + genome.getActiveAllele(EnumTreeChromosome.FERTILITY).getName(); + String yield = TextFormatting.WHITE + "Y: " + genome.getActiveAllele(EnumTreeChromosome.YIELD).getName(); list.add(String.format("%s, %s", saplings, maturation)); list.add(String.format("%s, %s", height, girth)); list.add(String.format("%s, %s", yield, sappiness)); IAlleleBoolean primaryFireproof = (IAlleleBoolean) genome.getActiveAllele(EnumTreeChromosome.FIREPROOF); if (primaryFireproof.getValue()) { - list.add(EnumChatFormatting.RED + Translator.translateToLocal("for.gui.fireresist")); + list.add(TextFormatting.RED + Translator.translateToLocal("for.gui.fireresist")); } IAllele fruit = getGenome().getActiveAllele(EnumTreeChromosome.FRUITS); if (fruit != AlleleFruit.fruitNone) { String strike = ""; if (!canBearFruit()) { - strike = EnumChatFormatting.STRIKETHROUGH.toString(); + strike = TextFormatting.STRIKETHROUGH.toString(); } - list.add(strike + EnumChatFormatting.GREEN + "F: " + genome.getFruitProvider().getDescription()); + list.add(strike + TextFormatting.GREEN + "F: " + genome.getFruitProvider().getDescription()); } } diff --git a/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java b/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java index 65cf7d3cb..d6fe560b2 100644 --- a/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeDefinition.java @@ -16,7 +16,7 @@ import java.util.Arrays; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.world.World; @@ -1036,7 +1036,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe @Override public void setLeaves(ITreeGenome genome, World world, GameProfile owner, BlockPos pos) { - boolean placed = world.setBlockState(pos, PluginArboriculture.blocks.leaves.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); + boolean placed = world.setBlockState(pos, PluginArboriculture.blocks.leaves.getDefaultState(), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); if (!placed) { return; } diff --git a/src/main/java/forestry/arboriculture/genetics/TreeMutation.java b/src/main/java/forestry/arboriculture/genetics/TreeMutation.java index 4e52e14f4..7bb1845a0 100755 --- a/src/main/java/forestry/arboriculture/genetics/TreeMutation.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeMutation.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.arboriculture.genetics; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.arboriculture.IAlleleTreeSpecies; diff --git a/src/main/java/forestry/arboriculture/genetics/TreeRoot.java b/src/main/java/forestry/arboriculture/genetics/TreeRoot.java index edd7033f8..ac8f3d7c0 100644 --- a/src/main/java/forestry/arboriculture/genetics/TreeRoot.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeRoot.java @@ -26,7 +26,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/arboriculture/genetics/alleles/AlleleLeafEffect.java b/src/main/java/forestry/arboriculture/genetics/alleles/AlleleLeafEffect.java index 4dd9aa3fd..1357cd01c 100644 --- a/src/main/java/forestry/arboriculture/genetics/alleles/AlleleLeafEffect.java +++ b/src/main/java/forestry/arboriculture/genetics/alleles/AlleleLeafEffect.java @@ -10,8 +10,8 @@ ******************************************************************************/ package forestry.arboriculture.genetics.alleles; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.arboriculture.EnumTreeChromosome; @@ -61,6 +61,6 @@ public class AlleleLeafEffect extends AlleleCategorized implements IAlleleLeafEf Vect min = offset.add(x, y, z); Vect max = min.add(area); - return AxisAlignedBB.fromBounds(min.getX(), min.getY(), min.getZ(), max.getX(), max.getY(), max.getZ()); + return new AxisAlignedBB(min.getX(), min.getY(), min.getZ(), max.getX(), max.getY(), max.getZ()); } } diff --git a/src/main/java/forestry/arboriculture/genetics/alleles/AlleleTreeSpecies.java b/src/main/java/forestry/arboriculture/genetics/alleles/AlleleTreeSpecies.java index 87e62d87f..a65935042 100644 --- a/src/main/java/forestry/arboriculture/genetics/alleles/AlleleTreeSpecies.java +++ b/src/main/java/forestry/arboriculture/genetics/alleles/AlleleTreeSpecies.java @@ -14,7 +14,7 @@ import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.common.EnumPlantType; diff --git a/src/main/java/forestry/arboriculture/gui/GuiTreealyzer.java b/src/main/java/forestry/arboriculture/gui/GuiTreealyzer.java index 7f886e22b..ba3e310a1 100755 --- a/src/main/java/forestry/arboriculture/gui/GuiTreealyzer.java +++ b/src/main/java/forestry/arboriculture/gui/GuiTreealyzer.java @@ -17,7 +17,7 @@ import java.util.Locale; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.EnumPlantType; @@ -228,14 +228,14 @@ public class GuiTreealyzer extends GuiAlyzer { String strike = ""; IAllele fruit0 = tree.getGenome().getActiveAllele(EnumTreeChromosome.FRUITS); if (!tree.canBearFruit() && fruit0 != AlleleFruit.fruitNone) { - strike = EnumChatFormatting.STRIKETHROUGH.toString(); + strike = TextFormatting.STRIKETHROUGH.toString(); } textLayout.drawLine(strike + tree.getGenome().getFruitProvider().getDescription(), COLUMN_1, fruitDominance0); strike = ""; IAlleleFruit fruit1 = (IAlleleFruit) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS); if (!tree.getGenome().getSecondary().getSuitableFruit().contains(fruit1.getProvider().getFamily()) && fruit1 != AlleleFruit.fruitNone) { - strike = EnumChatFormatting.STRIKETHROUGH.toString(); + strike = TextFormatting.STRIKETHROUGH.toString(); } textLayout.drawLine(strike + fruit1.getProvider().getDescription(), COLUMN_2, fruitDominance1); diff --git a/src/main/java/forestry/arboriculture/items/ItemBlockLeaves.java b/src/main/java/forestry/arboriculture/items/ItemBlockLeaves.java index ea07a2532..dfd56ecc1 100644 --- a/src/main/java/forestry/arboriculture/items/ItemBlockLeaves.java +++ b/src/main/java/forestry/arboriculture/items/ItemBlockLeaves.java @@ -14,7 +14,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/arboriculture/items/ItemBlockWoodDoor.java b/src/main/java/forestry/arboriculture/items/ItemBlockWoodDoor.java index eed8a45a4..b1f9643c5 100644 --- a/src/main/java/forestry/arboriculture/items/ItemBlockWoodDoor.java +++ b/src/main/java/forestry/arboriculture/items/ItemBlockWoodDoor.java @@ -5,7 +5,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemDoor; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java b/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java index cca53b63d..e87d3a01a 100755 --- a/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java +++ b/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java @@ -13,12 +13,12 @@ package forestry.arboriculture.items; import java.util.List; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/arboriculture/items/ItemGrafter.java b/src/main/java/forestry/arboriculture/items/ItemGrafter.java index 2d32e2ebc..2b2766c1d 100755 --- a/src/main/java/forestry/arboriculture/items/ItemGrafter.java +++ b/src/main/java/forestry/arboriculture/items/ItemGrafter.java @@ -16,7 +16,7 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.arboriculture.IToolGrafter; diff --git a/src/main/java/forestry/arboriculture/models/FruitPodStateMapper.java b/src/main/java/forestry/arboriculture/models/FruitPodStateMapper.java index ffb5a4967..ea8064ab7 100644 --- a/src/main/java/forestry/arboriculture/models/FruitPodStateMapper.java +++ b/src/main/java/forestry/arboriculture/models/FruitPodStateMapper.java @@ -4,7 +4,7 @@ import java.util.Map; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/forestry/arboriculture/models/ModelDecorativeLeaves.java b/src/main/java/forestry/arboriculture/models/ModelDecorativeLeaves.java index 2d46a6219..4a68300f0 100644 --- a/src/main/java/forestry/arboriculture/models/ModelDecorativeLeaves.java +++ b/src/main/java/forestry/arboriculture/models/ModelDecorativeLeaves.java @@ -14,10 +14,10 @@ import javax.annotation.Nonnull; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.property.IExtendedBlockState; @@ -39,39 +39,38 @@ public class ModelDecorativeLeaves extends ModelBlockOverlay & IBlockType & IStringSerializable> ext private final ParticleHelper.Callback particleCallback; - protected final BlockState blockState; + protected final BlockStateContainer blockState; private boolean canCreateProps = false; public BlockBase(Class

machinePropertiesClass) { - super(Material.iron); + super(Material.IRON); this.hasTESR = IBlockTypeTesr.class.isAssignableFrom(machinePropertiesClass); this.hasCustom = IBlockTypeCustom.class.isAssignableFrom(machinePropertiesClass); - this.lightOpacity = this.isOpaqueCube() ? 255 : 0; + this.lightOpacity = (!hasTESR && !hasCustom) ? 255 : 0; this.machinePropertiesClass = machinePropertiesClass; canCreateProps = true; @@ -116,21 +118,21 @@ public class BlockBase

& IBlockType & IStringSerializable> ext } @Override - public boolean isOpaqueCube() { - return !hasTESR && !hasCustom; - } - - @Override - public boolean isNormalCube() { + public boolean isOpaqueCube(IBlockState state) { return !hasTESR && !hasCustom; } @Override - public int getRenderType() { + public boolean isNormalCube(IBlockState state) { + return !hasTESR && !hasCustom; + } + + @Override + public EnumBlockRenderType getRenderType(IBlockState state) { if (hasTESR) { - return 2; + return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; } else { - return 3; + return EnumBlockRenderType.MODEL; } } @@ -143,21 +145,21 @@ public class BlockBase

& IBlockType & IStringSerializable> ext } @Override - public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) { - IMachineProperties definition = getDefinition(world, pos); + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { + IMachineProperties definition = getDefinition(worldIn, pos); if (definition == null) { - return super.getCollisionBoundingBox(world, pos, state); + return super.getCollisionBoundingBox(blockState, worldIn, pos); } - return definition.getBoundingBox(pos, state); + return definition.getBoundingBox(pos, blockState); } - + @Override - public MovingObjectPosition collisionRayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) { - IMachineProperties definition = getDefinition(world, pos); + public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) { + IMachineProperties definition = getDefinition(worldIn, pos); if (definition == null) { - return super.collisionRayTrace(world, pos, start, end); + return super.collisionRayTrace(blockState, worldIn, pos, start, end); } else { - return definition.collisionRayTrace(world, pos, start, end); + return definition.collisionRayTrace(worldIn, pos, start, end); } } @@ -182,43 +184,42 @@ public class BlockBase

& IBlockType & IStringSerializable> ext /* INTERACTION */ @Override - public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side) { + public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) { IMachineProperties definition = getDefinition(world, pos); return definition != null && definition.isSolidOnSide(world, pos, side); } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { - if (player.isSneaking()) { + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { + if (playerIn.isSneaking()) { return false; } - TileBase tile = TileUtil.getTile(world, pos, TileBase.class); + TileBase tile = TileUtil.getTile(worldIn, pos, TileBase.class); if (tile == null) { return false; } - if (!TileUtil.isUsableByPlayer(player, tile)) { + if (!TileUtil.isUsableByPlayer(playerIn, tile)) { return false; } IAccessHandler access = tile.getAccessHandler(); - ItemStack current = player.getCurrentEquippedItem(); - if (current != null && current.getItem() != Items.bucket && tile instanceof IFluidHandler && access.allowsAlteration(player)) { - if (FluidHelper.handleRightClick((IFluidHandler) tile, side, player, true, tile.canDrainWithBucket())) { + if (heldItem != null && heldItem.getItem() != Items.BUCKET && tile instanceof IFluidHandler && access.allowsAlteration(playerIn)) { + if (FluidHelper.handleRightClick((IFluidHandler) tile, side, playerIn, true, tile.canDrainWithBucket())) { return true; } } - if (world.isRemote) { + if (worldIn.isRemote) { return true; } - if (access.allowsViewing(player)) { - tile.openGui(player); + if (access.allowsViewing(playerIn)) { + tile.openGui(playerIn, heldItem); } else { - player.addChatMessage(new ChatComponentTranslation("for.chat.accesslocked", PlayerUtil.getOwnerName(access))); + playerIn.addChatMessage(new TextComponentTranslation("for.chat.accesslocked", PlayerUtil.getOwnerName(access))); } return true; } @@ -281,11 +282,11 @@ public class BlockBase

& IBlockType & IStringSerializable> ext } @Override - protected BlockState createBlockState() { + protected BlockStateContainer createBlockState() { if (!canCreateProps) { return super.createBlockState(); } - return new BlockState(this, TYPE, FACE); + return new BlockStateContainer(this, TYPE, FACE); } @Override @@ -325,35 +326,33 @@ public class BlockBase

& IBlockType & IStringSerializable> ext } @Override - public BlockState getBlockState() { + public BlockStateContainer getBlockState() { return this.blockState; } @Override - public boolean getUseNeighborBrightness() { + public boolean getUseNeighborBrightness(IBlockState state) { return hasTESR; } - + /* Particles */ @SideOnly(Side.CLIENT) @Override - public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer) { - IBlockState state = world.getBlockState(target.getBlockPos()); - - P protety = state.getValue(TYPE); - if(protety.getMachineProperties() instanceof IMachinePropertiesTesr){ - return ParticleHelper.addHitEffects(world, this, target, effectRenderer, particleCallback); + public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, EffectRenderer effectRenderer) { + P property = state.getValue(TYPE); + if(property.getMachineProperties() instanceof IMachinePropertiesTesr){ + return ParticleHelper.addHitEffects(worldObj, this, target, effectRenderer, particleCallback); } return false; } - + @SideOnly(Side.CLIENT) @Override public boolean addDestroyEffects(World world, BlockPos pos, EffectRenderer effectRenderer) { IBlockState state = world.getBlockState(pos); - P protety = state.getValue(TYPE); - if(protety.getMachineProperties() instanceof IMachinePropertiesTesr){ + P property = state.getValue(TYPE); + if(property.getMachineProperties() instanceof IMachinePropertiesTesr){ return ParticleHelper.addDestroyEffects(world, this, world.getBlockState(pos), pos, effectRenderer, particleCallback); } return false; diff --git a/src/main/java/forestry/core/blocks/BlockForestry.java b/src/main/java/forestry/core/blocks/BlockForestry.java index 5da30116c..fb0a41f4a 100644 --- a/src/main/java/forestry/core/blocks/BlockForestry.java +++ b/src/main/java/forestry/core/blocks/BlockForestry.java @@ -18,7 +18,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; diff --git a/src/main/java/forestry/core/blocks/BlockRegistryCore.java b/src/main/java/forestry/core/blocks/BlockRegistryCore.java index e7d94be84..0593b32ef 100644 --- a/src/main/java/forestry/core/blocks/BlockRegistryCore.java +++ b/src/main/java/forestry/core/blocks/BlockRegistryCore.java @@ -43,7 +43,6 @@ public class BlockRegistryCore extends BlockRegistry { OreDictionary.registerOre("blockBronze", resourceStorage.get(EnumResourceType.BRONZE)); // register some common oreDict names for our recipes - OreDictionary.registerOre("chestWood", Blocks.chest); - OreDictionary.registerOre("craftingTableWood", Blocks.crafting_table); + OreDictionary.registerOre("craftingTableWood", Blocks.CRAFTING_TABLE); } } diff --git a/src/main/java/forestry/core/blocks/BlockResourceOre.java b/src/main/java/forestry/core/blocks/BlockResourceOre.java index 044dfff96..910bc59eb 100644 --- a/src/main/java/forestry/core/blocks/BlockResourceOre.java +++ b/src/main/java/forestry/core/blocks/BlockResourceOre.java @@ -17,13 +17,13 @@ import com.google.common.base.Predicate; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -52,8 +52,8 @@ public class BlockResourceOre extends Block implements IItemModelRegister, IBloc } @Override - protected BlockState createBlockState() { - return new BlockState(this, ORE_RESOURCES); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, ORE_RESOURCES); } @Override diff --git a/src/main/java/forestry/core/blocks/BlockResourceStorage.java b/src/main/java/forestry/core/blocks/BlockResourceStorage.java index 7e4b541b6..ee6d07725 100644 --- a/src/main/java/forestry/core/blocks/BlockResourceStorage.java +++ b/src/main/java/forestry/core/blocks/BlockResourceStorage.java @@ -4,7 +4,7 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -20,7 +20,7 @@ public class BlockResourceStorage extends Block implements IItemModelRegister, I public static final PropertyEnum STORAGE_RESOURCES = PropertyEnum.create("resource", EnumResourceType.class); public BlockResourceStorage() { - super(Material.iron); + super(Material.IRON); setHardness(3F); setResistance(5F); setCreativeTab(CreativeTabForestry.tabForestry); @@ -28,8 +28,8 @@ public class BlockResourceStorage extends Block implements IItemModelRegister, I } @Override - protected BlockState createBlockState() { - return new BlockState(this, STORAGE_RESOURCES); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, STORAGE_RESOURCES); } @Override diff --git a/src/main/java/forestry/core/blocks/BlockSoil.java b/src/main/java/forestry/core/blocks/BlockSoil.java index 7935e7102..f1289684e 100644 --- a/src/main/java/forestry/core/blocks/BlockSoil.java +++ b/src/main/java/forestry/core/blocks/BlockSoil.java @@ -18,18 +18,19 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockLog; import net.minecraft.block.IGrowable; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -73,10 +74,10 @@ public class BlockSoil extends Block implements IItemModelRegister, IBlockWithMe private static final int degradeDelimiter = 3; public BlockSoil() { - super(Material.sand); + super(Material.GROUND); setTickRandomly(true); setHardness(0.5f); - setStepSound(soundTypeGrass); + setSoundType(SoundType.GROUND); setCreativeTab(CreativeTabForestry.tabForestry); } @@ -91,8 +92,8 @@ public class BlockSoil extends Block implements IItemModelRegister, IBlockWithMe } @Override - protected BlockState createBlockState() { - return new BlockState(this, SOIL); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, SOIL); } @Override @@ -108,9 +109,9 @@ public class BlockSoil extends Block implements IItemModelRegister, IBlockWithMe if (type == SoilType.PEAT) { ret.add(PluginCore.items.peat.getItemStack()); - ret.add(new ItemStack(Blocks.dirt)); + ret.add(new ItemStack(Blocks.DIRT)); } else if (type == SoilType.HUMUS) { - ret.add(new ItemStack(Blocks.dirt)); + ret.add(new ItemStack(Blocks.DIRT)); } else { ret.add(new ItemStack(this, 1, SoilType.BOG_EARTH.ordinal())); } @@ -118,11 +119,6 @@ public class BlockSoil extends Block implements IItemModelRegister, IBlockWithMe return ret; } - @Override - public int getDamageValue(World world, BlockPos pos) { - return getMetaFromState(world.getBlockState(pos)) & 0x03; - } - @Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { if (world.isRemote) { @@ -188,11 +184,11 @@ public class BlockSoil extends Block implements IItemModelRegister, IBlockWithMe meta = grade << 2 | type; if (grade >= degradeDelimiter) { - world.setBlockState(pos, Blocks.sand.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH); + world.setBlockState(pos, Blocks.SAND.getDefaultState(), Constants.FLAG_BLOCK_SYNCH); } else { world.setBlockState(pos, BlockUtil.getBlock(world, pos).getStateFromMeta(meta), Constants.FLAG_BLOCK_SYNCH); } - world.markBlockForUpdate(pos); + world.markBlockRangeForRenderUpdate(pos, pos); } private static boolean isMoistened(World world, BlockPos pos) { @@ -200,7 +196,7 @@ public class BlockSoil extends Block implements IItemModelRegister, IBlockWithMe for (int i = -2; i < 3; i++) { for (int j = -2; j < 3; j++) { Block block = world.getBlockState(new BlockPos(pos.getX() + i, pos.getY(), pos.getZ() + j)).getBlock(); - if (block == Blocks.water || block == Blocks.flowing_water) { + if (block == Blocks.WATER || block == Blocks.FLOWING_WATER) { return true; } } @@ -230,13 +226,14 @@ public class BlockSoil extends Block implements IItemModelRegister, IBlockWithMe maturity++; meta = maturity << 2 | type; - world.setBlockState(pos, BlockUtil.getBlock(world, pos).getStateFromMeta(meta), Constants.FLAG_BLOCK_SYNCH); - world.markBlockForUpdate(pos); + Block block = BlockUtil.getBlock(world, pos); + world.setBlockState(pos, block.getStateFromMeta(meta), Constants.FLAG_BLOCK_SYNCH); + world.markBlockRangeForRenderUpdate(pos, pos); } @Override - public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plant) { - EnumPlantType plantType = plant.getPlantType(world, pos); + public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { + EnumPlantType plantType = plantable.getPlantType(world, pos); if (plantType != EnumPlantType.Crop && plantType != EnumPlantType.Plains) { return false; } diff --git a/src/main/java/forestry/core/blocks/BlockStructure.java b/src/main/java/forestry/core/blocks/BlockStructure.java index 80fea37bf..cac84d6ac 100644 --- a/src/main/java/forestry/core/blocks/BlockStructure.java +++ b/src/main/java/forestry/core/blocks/BlockStructure.java @@ -17,9 +17,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; @@ -30,7 +32,6 @@ import forestry.core.circuits.ISocketable; import forestry.core.multiblock.MultiblockTileEntityForestry; import forestry.core.multiblock.MultiblockUtil; import forestry.core.utils.InventoryUtil; -import forestry.core.utils.Translator; public abstract class BlockStructure extends BlockForestry { @@ -47,12 +48,12 @@ public abstract class BlockStructure extends BlockForestry { private long previousMessageTick = 0; @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { - if (player.isSneaking()) { + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { + if (playerIn.isSneaking()) { return false; } - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = worldIn.getTileEntity(pos); if (!(tile instanceof MultiblockTileEntityForestry)) { return false; } @@ -62,21 +63,21 @@ public abstract class BlockStructure extends BlockForestry { // 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) { + if (heldItem == null) { if (controller != null) { if (!controller.isAssembled()) { String validationError = controller.getLastValidationError(); if (validationError != null) { - long tick = world.getTotalWorldTime(); + long tick = worldIn.getTotalWorldTime(); if (tick > previousMessageTick + 20) { - player.addChatMessage(new ChatComponentText(validationError)); + playerIn.addChatMessage(new TextComponentString(validationError)); previousMessageTick = tick; } return true; } } } else { - player.addChatMessage(new ChatComponentText(Translator.translateToLocal("for.multiblock.error.notConnected"))); + playerIn.addChatMessage(new TextComponentTranslation("for.multiblock.error.notConnected")); return true; } } @@ -86,8 +87,8 @@ public abstract class BlockStructure extends BlockForestry { return false; } - if (!world.isRemote) { - part.openGui(player); + if (!worldIn.isRemote) { + part.openGui(playerIn); } return true; } diff --git a/src/main/java/forestry/core/blocks/IMachineProperties.java b/src/main/java/forestry/core/blocks/IMachineProperties.java index 404672113..b0a86f98e 100644 --- a/src/main/java/forestry/core/blocks/IMachineProperties.java +++ b/src/main/java/forestry/core/blocks/IMachineProperties.java @@ -19,12 +19,12 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -60,7 +60,7 @@ public interface IMachineProperties extends IStringSeria AxisAlignedBB getBoundingBox(@Nonnull BlockPos pos, @Nonnull IBlockState state); @Nonnull - MovingObjectPosition collisionRayTrace(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull Vec3 startVec, @Nonnull Vec3 endVec); + RayTraceResult collisionRayTrace(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull Vec3d startVec, @Nonnull Vec3d endVec); boolean isSolidOnSide(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side); diff --git a/src/main/java/forestry/core/blocks/MachineProperties.java b/src/main/java/forestry/core/blocks/MachineProperties.java index f2e2f1849..15737b35c 100644 --- a/src/main/java/forestry/core/blocks/MachineProperties.java +++ b/src/main/java/forestry/core/blocks/MachineProperties.java @@ -10,11 +10,11 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -41,7 +41,7 @@ public class MachineProperties implements IMachineProper private Block block; public MachineProperties(int meta, @Nonnull Class teClass, @Nonnull String name) { - this(meta, "forestry." + name, teClass, name, AxisAlignedBB.fromBounds(0, 0, 0, 1, 1, 1)); + this(meta, "forestry." + name, teClass, name, new AxisAlignedBB(0, 0, 0, 1, 1, 1)); } public MachineProperties(int meta, @Nonnull Class teClass, @Nonnull String name, @Nonnull AxisAlignedBB boundingBox) { @@ -80,7 +80,7 @@ public class MachineProperties implements IMachineProper @Nonnull @Override - public MovingObjectPosition collisionRayTrace(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull Vec3 startVec, @Nonnull Vec3 endVec) { + public RayTraceResult collisionRayTrace(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull Vec3d startVec, @Nonnull Vec3d endVec) { return BlockUtil.collisionRayTrace(pos, startVec, endVec, boundingBox); } diff --git a/src/main/java/forestry/core/blocks/MachinePropertiesTesr.java b/src/main/java/forestry/core/blocks/MachinePropertiesTesr.java index ad1c907fa..1026cde6b 100644 --- a/src/main/java/forestry/core/blocks/MachinePropertiesTesr.java +++ b/src/main/java/forestry/core/blocks/MachinePropertiesTesr.java @@ -5,7 +5,7 @@ import javax.annotation.Nullable; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.Item; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.fml.client.registry.ClientRegistry; diff --git a/src/main/java/forestry/core/blocks/propertys/UnlistedBlockPos.java b/src/main/java/forestry/core/blocks/propertys/UnlistedBlockPos.java index 7e2eb46df..ef3c40a55 100644 --- a/src/main/java/forestry/core/blocks/propertys/UnlistedBlockPos.java +++ b/src/main/java/forestry/core/blocks/propertys/UnlistedBlockPos.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.core.blocks.propertys; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.property.IUnlistedProperty; diff --git a/src/main/java/forestry/core/circuits/CircuitBoard.java b/src/main/java/forestry/core/circuits/CircuitBoard.java index 0c55835a7..87f8d99b2 100755 --- a/src/main/java/forestry/core/circuits/CircuitBoard.java +++ b/src/main/java/forestry/core/circuits/CircuitBoard.java @@ -15,7 +15,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import forestry.api.circuits.ChipsetManager; import forestry.api.circuits.ICircuit; @@ -79,7 +79,7 @@ public class CircuitBoard implements ICircuitBoard { @Override public void addTooltip(List list) { if (layout != null) { - list.add(EnumChatFormatting.GOLD + layout.getUsage() + ":"); + list.add(TextFormatting.GOLD + layout.getUsage() + ":"); } List extendedTooltip = new ArrayList<>(); @@ -92,7 +92,7 @@ public class CircuitBoard implements ICircuitBoard { if (Proxies.common.isShiftDown() || extendedTooltip.size() <= 4) { list.addAll(extendedTooltip); } else { - list.add(EnumChatFormatting.ITALIC + "<" + Translator.translateToLocal("for.gui.tooltip.tmi") + ">"); + list.add(TextFormatting.ITALIC + "<" + Translator.translateToLocal("for.gui.tooltip.tmi") + ">"); } } diff --git a/src/main/java/forestry/core/commands/CommandHelpers.java b/src/main/java/forestry/core/commands/CommandHelpers.java index 84d37640a..09f38e015 100644 --- a/src/main/java/forestry/core/commands/CommandHelpers.java +++ b/src/main/java/forestry/core/commands/CommandHelpers.java @@ -21,12 +21,11 @@ import net.minecraft.command.PlayerNotFoundException; import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.ChatStyle; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import forestry.core.utils.Translator; @@ -35,41 +34,13 @@ import forestry.core.utils.Translator; */ public class CommandHelpers { - public static World getWorld(ICommandSender sender, IForestryCommand command, String[] args, int worldArgIndex) throws WrongUsageException { - // Handle passed in world argument - if (worldArgIndex < args.length) { - try { - int dim = Integer.parseInt(args[worldArgIndex]); - World world = MinecraftServer.getServer().worldServerForDimension(dim); - if (world != null) { - return world; - } - } catch (NumberFormatException e) { - throwWrongUsage(sender, command); - } - } - return getWorld(sender, command); - } - - public static World getWorld(ICommandSender sender, IForestryCommand command) { - return sender.getEntityWorld(); - } - - public static EntityPlayerMP getPlayer(ICommandSender sender, String playerName) throws PlayerNotFoundException { - return CommandBase.getPlayer(sender, playerName); - } - - public static String[] getPlayers() { - return MinecraftServer.getServer().getAllUsernames(); - } - public static void sendLocalizedChatMessage(ICommandSender sender, String locTag, Object... args) { - sender.addChatMessage(new ChatComponentTranslation(locTag, args)); + sender.addChatMessage(new TextComponentTranslation(locTag, args)); } - public static void sendLocalizedChatMessage(ICommandSender sender, ChatStyle chatStyle, String locTag, Object... args) { - ChatComponentTranslation chat = new ChatComponentTranslation(locTag, args); - chat.setChatStyle(chatStyle); + public static void sendLocalizedChatMessage(ICommandSender sender, Style chatStyle, String locTag, Object... args) { + TextComponentTranslation chat = new TextComponentTranslation(locTag, args); + chat.setStyle(chatStyle); sender.addChatMessage(chat); } @@ -81,32 +52,32 @@ public class CommandHelpers { * Messages will not be localized properly if you use StringUtil.localize(). */ public static void sendChatMessage(ICommandSender sender, String message) { - sender.addChatMessage(new ChatComponentText(message)); + sender.addChatMessage(new TextComponentString(message)); } public static void throwWrongUsage(ICommandSender sender, IForestryCommand command) throws WrongUsageException { throw new WrongUsageException(Translator.translateToLocalFormatted("for.chat.help", command.getCommandUsage(sender))); } - public static void processChildCommand(ICommandSender sender, SubCommand child, String[] args) throws CommandException { + public static void processChildCommand(MinecraftServer server, ICommandSender sender, SubCommand child, String[] args) throws CommandException { if (!sender.canCommandSenderUseCommand(child.getPermissionLevel(), child.getFullCommandString())) { throw new WrongUsageException(Translator.translateToLocal("for.chat.command.noperms")); } String[] newargs = new String[args.length - 1]; System.arraycopy(args, 1, newargs, 0, newargs.length); - child.processCommand(sender, newargs); + child.execute(server, sender, newargs); } public static void printHelp(ICommandSender sender, IForestryCommand command) { String commandString = command.getFullCommandString().replace(" ", "."); - ChatStyle header = new ChatStyle(); - header.setColor(EnumChatFormatting.BLUE); + Style header = new Style(); + header.setColor(TextFormatting.BLUE); sendLocalizedChatMessage(sender, header, "for.chat.command." + commandString + ".format", command.getFullCommandString()); - ChatStyle body = new ChatStyle(); - body.setColor(EnumChatFormatting.GRAY); + Style body = new Style(); + body.setColor(TextFormatting.GRAY); List commandAliases = command.getCommandAliases(); if (!commandAliases.isEmpty()) { @@ -128,15 +99,15 @@ public class CommandHelpers { } } - public static boolean processStandardCommands(ICommandSender sender, IForestryCommand command, String[] args) throws CommandException { + public static boolean processStandardCommands(MinecraftServer server, ICommandSender sender, IForestryCommand command, String[] args) throws CommandException { if (args.length >= 1) { if (args[0].equals("help")) { - command.printHelp(sender); + command.printHelp(, sender); return true; } for (SubCommand child : command.getChildren()) { if (matches(args[0], child)) { - processChildCommand(sender, child, args); + processChildCommand(server, sender, child, args); return true; } } @@ -161,13 +132,13 @@ public class CommandHelpers { return CommandBase.getListOfStringsMatchingLastWord(strings, lastWords); } - public static List addStandardTabCompletionOptions(IForestryCommand command, ICommandSender sender, String[] incomplete, BlockPos pos) { + public static List addStandardTabCompletionOptions(MinecraftServer server, IForestryCommand command, ICommandSender sender, String[] incomplete, BlockPos pos) { if (incomplete.length > 1) { String commandName = incomplete[0]; for (SubCommand child : command.getChildren()) { if (CommandHelpers.matches(commandName, child)) { String[] incompleteRemaining = Arrays.copyOfRange(incomplete, 1, incomplete.length); - return child.addTabCompletionOptions(sender, incompleteRemaining, pos); + return child.getTabCompletionOptions(server, sender, incompleteRemaining, pos); } } } diff --git a/src/main/java/forestry/core/commands/CommandModeInfo.java b/src/main/java/forestry/core/commands/CommandModeInfo.java index a0f7bac35..d52c67873 100644 --- a/src/main/java/forestry/core/commands/CommandModeInfo.java +++ b/src/main/java/forestry/core/commands/CommandModeInfo.java @@ -14,10 +14,12 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; +import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatStyle; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; public class CommandModeInfo extends SubCommand { @@ -34,9 +36,9 @@ public class CommandModeInfo extends SubCommand { } @Override - public void processSubCommand(ICommandSender sender, String[] args) { + public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length <= 0) { - printHelp(sender); + printHelp(, sender); return; } @@ -44,12 +46,12 @@ public class CommandModeInfo extends SubCommand { if (modeName == null) { CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.info.error", args[0]); - printHelp(sender); + printHelp(, sender); return; } - ChatStyle green = new ChatStyle(); - green.setColor(EnumChatFormatting.GREEN); + Style green = new Style(); + green.setColor(TextFormatting.GREEN); CommandHelpers.sendLocalizedChatMessage(sender, green, modeName); for (String desc : modeHelper.getDescription(modeName)) { @@ -61,7 +63,7 @@ public class CommandModeInfo extends SubCommand { public void printHelp(ICommandSender sender) { super.printHelp(sender); - World world = CommandHelpers.getWorld(sender, this); + World world = sender.getEntityWorld(); String modeName = modeHelper.getModeName(world); String worldName = String.valueOf(world.getWorldInfo().getSaveVersion()); @@ -71,7 +73,7 @@ public class CommandModeInfo extends SubCommand { } @Override - public List addTabCompletionOptions(ICommandSender sender, String[] incomplete, BlockPos pos) { - return CommandHelpers.getListOfStringsMatchingLastWord(incomplete, modeStringArr); + public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { + return CommandHelpers.getListOfStringsMatchingLastWord(args, modeStringArr); } } diff --git a/src/main/java/forestry/core/commands/CommandModeSet.java b/src/main/java/forestry/core/commands/CommandModeSet.java index 0ebf66f7d..7c5ea09a3 100644 --- a/src/main/java/forestry/core/commands/CommandModeSet.java +++ b/src/main/java/forestry/core/commands/CommandModeSet.java @@ -14,7 +14,8 @@ import java.util.List; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; -import net.minecraft.util.BlockPos; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public final class CommandModeSet extends SubCommand { @@ -31,25 +32,20 @@ public final class CommandModeSet extends SubCommand { } @Override - public void processSubCommand(ICommandSender sender, String[] args) throws WrongUsageException { + public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws WrongUsageException { if (args.length == 0 || args.length > 2) { - printHelp(sender); + printHelp(, sender); return; } - World world; - if (args.length == 2) { - world = CommandHelpers.getWorld(sender, this, args, 0); - } else { - world = CommandHelpers.getWorld(sender, this); - } + World world = sender.getEntityWorld(); String desired = args[args.length - 1]; String modeName = modeSetter.getModeNameMatching(desired); if (modeName == null) { CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.set.error", desired); - printHelp(sender); + printHelp(, sender); return; } @@ -58,7 +54,7 @@ public final class CommandModeSet extends SubCommand { } @Override - public List addTabCompletionOptions(ICommandSender sender, String[] incomplete, BlockPos pos) { - return CommandHelpers.getListOfStringsMatchingLastWord(incomplete, modeStringArr); + public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { + return CommandHelpers.getListOfStringsMatchingLastWord(args, modeStringArr); } } diff --git a/src/main/java/forestry/core/commands/CommandPlugins.java b/src/main/java/forestry/core/commands/CommandPlugins.java index 75c00aed5..80bf02b45 100644 --- a/src/main/java/forestry/core/commands/CommandPlugins.java +++ b/src/main/java/forestry/core/commands/CommandPlugins.java @@ -13,7 +13,7 @@ package forestry.core.commands; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import forestry.core.utils.Translator; import forestry.plugins.ForestryPlugin; @@ -52,7 +52,7 @@ public class CommandPlugins extends SubCommand { } private static String makeListEntry(IForestryPlugin plugin) { - String entry = plugin.isAvailable() ? EnumChatFormatting.GREEN.toString() : EnumChatFormatting.RED.toString(); + String entry = plugin.isAvailable() ? TextFormatting.GREEN.toString() : TextFormatting.RED.toString(); ForestryPlugin info = plugin.getClass().getAnnotation(ForestryPlugin.class); if (info != null) { @@ -101,19 +101,19 @@ public class CommandPlugins extends SubCommand { throw new CommandException(Translator.translateToLocalFormatted("for.chat.plugins.error", pluginUid)); } - EnumChatFormatting formatting = found.isAvailable() ? EnumChatFormatting.GREEN : EnumChatFormatting.RED; + TextFormatting formatting = found.isAvailable() ? TextFormatting.GREEN : TextFormatting.RED; ForestryPlugin info = found.getClass().getAnnotation(ForestryPlugin.class); if (info != null) { CommandHelpers.sendChatMessage(sender, formatting + "Plugin: " + info.name()); if (!info.version().isEmpty()) { - CommandHelpers.sendChatMessage(sender, EnumChatFormatting.BLUE + "Version: " + info.version()); + CommandHelpers.sendChatMessage(sender, TextFormatting.BLUE + "Version: " + info.version()); } if (!info.author().isEmpty()) { - CommandHelpers.sendChatMessage(sender, EnumChatFormatting.BLUE + "Author(s): " + info.author()); + CommandHelpers.sendChatMessage(sender, TextFormatting.BLUE + "Author(s): " + info.author()); } if (!info.url().isEmpty()) { - CommandHelpers.sendChatMessage(sender, EnumChatFormatting.BLUE + "URL: " + info.url()); + CommandHelpers.sendChatMessage(sender, TextFormatting.BLUE + "URL: " + info.url()); } if (!info.unlocalizedDescription().isEmpty()) { CommandHelpers.sendChatMessage(sender, Translator.translateToLocal(info.unlocalizedDescription())); diff --git a/src/main/java/forestry/core/commands/CommandSaveStats.java b/src/main/java/forestry/core/commands/CommandSaveStats.java index 348b9ba6b..2facf0c55 100644 --- a/src/main/java/forestry/core/commands/CommandSaveStats.java +++ b/src/main/java/forestry/core/commands/CommandSaveStats.java @@ -21,10 +21,12 @@ import java.util.Collection; import java.util.Date; import java.util.List; +import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.command.PlayerNotFoundException; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.BlockPos; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.genetics.AlleleManager; @@ -74,9 +76,9 @@ public final class CommandSaveStats extends SubCommand { EntityPlayerMP player; if (args.length > 0) { - player = CommandHelpers.getPlayer(sender, args[0]); + player = CommandBase.getPlayer((MinecraftServer) sender, (ICommandSender) args[0], null); } else { - player = CommandHelpers.getPlayer(sender, sender.getName()); + player = CommandBase.getPlayer((MinecraftServer) sender, (ICommandSender) sender.getName(), null); } Collection statistics = new ArrayList<>(); diff --git a/src/main/java/forestry/core/commands/RootCommand.java b/src/main/java/forestry/core/commands/RootCommand.java index 51c51adea..5d00dd657 100644 --- a/src/main/java/forestry/core/commands/RootCommand.java +++ b/src/main/java/forestry/core/commands/RootCommand.java @@ -18,7 +18,7 @@ import java.util.TreeSet; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import forestry.core.config.Constants; @@ -95,7 +95,7 @@ public class RootCommand extends CommandBase implements IForestryCommand { } @Override - public void printHelp(ICommandSender sender) { + public void printHelp(MinecraftServer server, ICommandSender sender) { CommandHelpers.printHelp(sender, this); } diff --git a/src/main/java/forestry/core/commands/SubCommand.java b/src/main/java/forestry/core/commands/SubCommand.java index 84cbba095..044467428 100644 --- a/src/main/java/forestry/core/commands/SubCommand.java +++ b/src/main/java/forestry/core/commands/SubCommand.java @@ -20,7 +20,8 @@ import net.minecraft.command.CommandException; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; -import net.minecraft.util.BlockPos; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; /** * @author CovertJaguar @@ -76,21 +77,21 @@ public abstract class SubCommand implements IForestryCommand { public List getCommandAliases() { return aliases; } - + @Override - public List addTabCompletionOptions(ICommandSender sender, String[] incomplete, BlockPos pos) { - return CommandHelpers.addStandardTabCompletionOptions(this, sender, incomplete, pos); + public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { + return CommandHelpers.addStandardTabCompletionOptions(server, this, sender, args, pos); } @Override - public final void processCommand(ICommandSender sender, String[] args) throws WrongUsageException, CommandException { - if (!CommandHelpers.processStandardCommands(sender, this, args)) { - processSubCommand(sender, args); + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + if (!CommandHelpers.processStandardCommands(server, sender, this, args)) { + executeSubCommand(server, sender, args); } } - public void processSubCommand(ICommandSender sender, String[] args) throws WrongUsageException, CommandException { - printHelp(sender); + public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws WrongUsageException, CommandException { + printHelp(, sender); } public SubCommand setPermLevel(PermLevel permLevel) { @@ -104,7 +105,7 @@ public abstract class SubCommand implements IForestryCommand { } @Override - public boolean canCommandSenderUseCommand(ICommandSender sender) { + public boolean checkPermission(MinecraftServer server, ICommandSender sender) { return sender.canCommandSenderUseCommand(getPermissionLevel(), getCommandName()); } diff --git a/src/main/java/forestry/core/entities/EntityFXColoredDropParticle.java b/src/main/java/forestry/core/entities/EntityFXColoredDropParticle.java index 80065776e..3ef97e735 100644 --- a/src/main/java/forestry/core/entities/EntityFXColoredDropParticle.java +++ b/src/main/java/forestry/core/entities/EntityFXColoredDropParticle.java @@ -10,12 +10,13 @@ ******************************************************************************/ package forestry.core.entities; +import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.particle.EntityFX; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; public class EntityFXColoredDropParticle extends EntityFX { @@ -47,41 +48,42 @@ public class EntityFXColoredDropParticle extends EntityFX { this.prevPosY = this.posY; this.prevPosZ = this.posZ; - this.motionY -= this.particleGravity; + this.ySpeed -= this.particleGravity; if (this.bobTimer-- > 0) { - this.motionX *= 0.02D; - this.motionY *= 0.02D; - this.motionZ *= 0.02D; + this.xSpeed *= 0.02D; + this.ySpeed *= 0.02D; + this.zSpeed *= 0.02D; this.setParticleTextureIndex(113); } else { this.setParticleTextureIndex(112); } - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.9800000190734863D; - this.motionY *= 0.9800000190734863D; - this.motionZ *= 0.9800000190734863D; + this.moveEntity(this.xSpeed, this.ySpeed, this.zSpeed); + this.xSpeed *= 0.9800000190734863D; + this.ySpeed *= 0.9800000190734863D; + this.zSpeed *= 0.9800000190734863D; if (this.particleMaxAge-- <= 0) { - this.setDead(); + this.setExpired(); } - if (this.onGround) { + if (this.isCollided) { this.setParticleTextureIndex(114); - this.motionX *= 0.699999988079071D; - this.motionZ *= 0.699999988079071D; + this.xSpeed *= 0.699999988079071D; + this.zSpeed *= 0.699999988079071D; } IBlockState state = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))); - Material material = state.getBlock().getMaterial(); + Block block = state.getBlock(); + Material material = block.getMaterial(state); if (material.isLiquid() || material.isSolid()) { - double d0 = MathHelper.floor_double(this.posY) + 1 - BlockLiquid.getLiquidHeightPercent(state.getBlock().getMetaFromState(state)); + double d0 = MathHelper.floor_double(this.posY) + 1 - BlockLiquid.getLiquidHeightPercent(block.getMetaFromState(state)); if (this.posY < d0) { - this.setDead(); + this.setExpired(); } } } diff --git a/src/main/java/forestry/core/entities/EntityFXIgnition.java b/src/main/java/forestry/core/entities/EntityFXIgnition.java index 2cd4fadfd..f7386924f 100644 --- a/src/main/java/forestry/core/entities/EntityFXIgnition.java +++ b/src/main/java/forestry/core/entities/EntityFXIgnition.java @@ -11,7 +11,7 @@ package forestry.core.entities; import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.entity.Entity; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; @@ -25,15 +25,14 @@ public class EntityFXIgnition extends EntityFX { public EntityFXIgnition(World world, double x, double y, double z) { super(world, x, y, z, 0, 0, 0); - this.motionX *= 0.8; - this.motionY *= 0.8; - this.motionZ *= 0.8; - this.motionY = this.rand.nextFloat() * 0.4F + 0.05F; + this.xSpeed *= 0.8; + this.ySpeed *= 0.8; + this.zSpeed *= 0.8; + this.ySpeed = this.rand.nextFloat() * 0.4F + 0.05F; this.particleRed = this.particleGreen = this.particleBlue = 1.0F; this.particleScale *= this.rand.nextFloat() / 2 + 0.3F; this.ignitionParticleScale = this.particleScale; this.particleMaxAge = (int) (16.0 / (Math.random() * 0.8 + 0.2)); - this.noClip = false; this.setParticleTextureIndex(49); } @@ -45,19 +44,11 @@ public class EntityFXIgnition extends EntityFX { return short1 | j << 16; } - /** - * Gets how bright this entity is. - */ @Override - public float getBrightness(float p_70013_1_) { - return 1.0F; - } - - @Override - public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) { + public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { float f6 = (this.particleAge + partialTicks) / this.particleMaxAge; this.particleScale = this.ignitionParticleScale * (1.0F - f6 * f6); - super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ); } /** @@ -70,24 +61,24 @@ public class EntityFXIgnition extends EntityFX { this.prevPosZ = this.posZ; if (this.particleAge++ >= this.particleMaxAge) { - this.setDead(); + this.setExpired(); } float f = (float) this.particleAge / (float) this.particleMaxAge; if (this.rand.nextFloat() > f * 2) { - this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ); + this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, this.xSpeed, this.ySpeed, this.zSpeed); } - this.motionY -= 0.03D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.999D; - this.motionY *= 0.999D; - this.motionZ *= 0.999D; + this.ySpeed -= 0.03D; + this.moveEntity(this.xSpeed, this.ySpeed, this.zSpeed); + this.xSpeed *= 0.999D; + this.ySpeed *= 0.999D; + this.zSpeed *= 0.999D; - if (this.onGround) { - this.motionX *= 0.7; - this.motionZ *= 0.7; + if (this.isCollided) { + this.xSpeed *= 0.7; + this.zSpeed *= 0.7; } } } \ No newline at end of file diff --git a/src/main/java/forestry/core/entities/EntityFXSmoke.java b/src/main/java/forestry/core/entities/EntityFXSmoke.java index d774b7e9b..f4c6df1ae 100644 --- a/src/main/java/forestry/core/entities/EntityFXSmoke.java +++ b/src/main/java/forestry/core/entities/EntityFXSmoke.java @@ -11,7 +11,7 @@ package forestry.core.entities; import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.entity.Entity; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; @@ -25,15 +25,14 @@ public class EntityFXSmoke extends EntityFX { public EntityFXSmoke(World world, double x, double y, double z) { super(world, x, y, z, 0, 0, 0); - this.motionX *= 0.8; - this.motionY *= 0.8; - this.motionZ *= 0.8; - this.motionY = this.rand.nextFloat() * 0.2F + 0.05F; + this.xSpeed *= 0.8; + this.xSpeed *= 0.8; + this.xSpeed *= 0.8; + this.xSpeed = this.rand.nextFloat() * 0.2F + 0.05F; this.particleRed = this.particleGreen = this.particleBlue = 1.0F; this.particleScale *= this.rand.nextFloat() / 4; this.ignitionParticleScale = this.particleScale; this.particleMaxAge = (int) (16.0 / (Math.random() * 0.8 + 0.2)); - this.noClip = false; this.setParticleTextureIndex(49); } @@ -44,19 +43,11 @@ public class EntityFXSmoke extends EntityFX { return 240 | j << 16; } - /** - * Gets how bright this entity is. - */ @Override - public float getBrightness(float p_70013_1_) { - return 1.0F; - } - - @Override - public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) { + public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { float f6 = (this.particleAge + partialTicks) / this.particleMaxAge; this.particleScale = this.ignitionParticleScale * (1.0F - f6 * f6); - super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ); } /** @@ -69,24 +60,24 @@ public class EntityFXSmoke extends EntityFX { this.prevPosZ = this.posZ; if (this.particleAge++ >= this.particleMaxAge) { - this.setDead(); + this.setExpired(); } float f = (float) this.particleAge / (float) this.particleMaxAge; if (this.rand.nextFloat() > f * 2) { - this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ); + this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX, this.posY, this.posZ, this.xSpeed, this.ySpeed, this.zSpeed); } - this.motionY -= 0.03D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 0.999D; - this.motionY *= 0.999D; - this.motionZ *= 0.999D; + this.ySpeed -= 0.03D; + this.moveEntity(this.xSpeed, this.ySpeed, this.zSpeed); + this.xSpeed *= 0.999D; + this.ySpeed *= 0.999D; + this.zSpeed *= 0.999D; - if (this.onGround) { - this.motionX *= 0.7; - this.motionZ *= 0.7; + if (this.isCollided) { + this.xSpeed *= 0.7; + this.zSpeed *= 0.7; } } } \ No newline at end of file diff --git a/src/main/java/forestry/core/entities/EntityFXSnow.java b/src/main/java/forestry/core/entities/EntityFXSnow.java index 85c68f05a..35dbb1c9b 100644 --- a/src/main/java/forestry/core/entities/EntityFXSnow.java +++ b/src/main/java/forestry/core/entities/EntityFXSnow.java @@ -11,7 +11,7 @@ package forestry.core.entities; import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.entity.Entity; import net.minecraft.world.World; @@ -23,14 +23,13 @@ public class EntityFXSnow extends EntityFX { public EntityFXSnow(World world, double x, double y, double z) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); - this.setParticleIcon(sprites[rand.nextInt(sprites.length)]); + this.setParticleTexture(sprites[rand.nextInt(sprites.length)]); this.particleScale *= 0.5F; this.particleMaxAge = (int) (40.0D / (Math.random() * 0.8D + 0.2D)); - this.noClip = true; - this.motionX *= 0.01D; - this.motionY *= -0.4D; - this.motionZ *= 0.01D; + this.xSpeed *= 0.01D; + this.ySpeed *= -0.4D; + this.zSpeed *= 0.01D; } @Override @@ -39,10 +38,10 @@ public class EntityFXSnow extends EntityFX { } @Override - public void renderParticle(WorldRenderer worldRenderer, Entity entity, float timeStep, float rotationX, float rotationXZ, float rotationZ, float rotationYZ, float rotationXY) { - double x = this.prevPosX + (this.posX - this.prevPosX) * timeStep - interpPosX; - double y = this.prevPosY + (this.posY - this.prevPosY) * timeStep - interpPosY; - double z = this.prevPosZ + (this.posZ - this.prevPosZ) * timeStep - interpPosZ; + public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { + double x = this.prevPosX + (this.posX - this.prevPosX) * partialTicks - interpPosX; + double y = this.prevPosY + (this.posY - this.prevPosY) * partialTicks - interpPosY; + double z = this.prevPosZ + (this.posZ - this.prevPosZ) * partialTicks - interpPosZ; float minU = this.particleTextureIndexX / 16.0F; float maxU = minU + 0.0624375F; @@ -50,25 +49,25 @@ public class EntityFXSnow extends EntityFX { float maxV = minV + 0.0624375F; float scale = 0.1F * this.particleScale; - if (this.particleIcon != null) { - minU = this.particleIcon.getMinU(); - maxU = this.particleIcon.getMaxU(); - minV = this.particleIcon.getMinV(); - maxV = this.particleIcon.getMaxV(); + if (this.particleTexture != null) { + minU = this.particleTexture.getMinU(); + maxU = this.particleTexture.getMaxU(); + minV = this.particleTexture.getMinV(); + maxV = this.particleTexture.getMaxV(); } for (int i = 0; i < 5; i++) { - renderParticle(worldRenderer, x, y, z, rotationX, rotationXZ, rotationZ, rotationYZ, rotationXY, minU, maxU, minV, maxV, scale, timeStep); + renderParticle(worldRendererIn, x, y, z, rotationX, rotationXZ, rotationZ, rotationYZ, rotationXY, minU, maxU, minV, maxV, scale, partialTicks); } } - private void renderParticle(WorldRenderer worldRenderer, double x, double y, double z, float rotationX, float rotationXZ, float rotationZ, float rotationYZ, float rotationXY, float minU, float maxU, float minV, float maxV, float scale, float timeStep) { + private void renderParticle(VertexBuffer worldRendererIn, double x, double y, double z, float rotationX, float rotationXZ, float rotationZ, float rotationYZ, float rotationXY, float minU, float maxU, float minV, float maxV, float scale, float timeStep) { int i = this.getBrightnessForRender(timeStep); int j = i >> 16 & 65535; int k = i & 65535; - worldRenderer.pos(x - rotationX * scale - rotationYZ * scale, y - rotationXZ * scale, z - rotationZ * scale - rotationXY * scale).tex(maxU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); - worldRenderer.pos(x - rotationX * scale + rotationYZ * scale, y + rotationXZ * scale, z - rotationZ * scale + rotationXY * scale).tex(maxU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); - worldRenderer.pos(x + rotationX * scale + rotationYZ * scale, y + rotationXZ * scale, z + rotationZ * scale + rotationXY * scale).tex(minU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); - worldRenderer.pos(x + rotationX * scale - rotationYZ * scale, y - rotationXZ * scale, z + rotationZ * scale - rotationXY * scale).tex(minU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRendererIn.pos(x - rotationX * scale - rotationYZ * scale, y - rotationXZ * scale, z - rotationZ * scale - rotationXY * scale).tex(maxU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRendererIn.pos(x - rotationX * scale + rotationYZ * scale, y + rotationXZ * scale, z - rotationZ * scale + rotationXY * scale).tex(maxU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRendererIn.pos(x + rotationX * scale + rotationYZ * scale, y + rotationXZ * scale, z + rotationZ * scale + rotationXY * scale).tex(minU, minV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRendererIn.pos(x + rotationX * scale - rotationYZ * scale, y - rotationXZ * scale, z + rotationZ * scale - rotationXY * scale).tex(minU, maxV).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); } } diff --git a/src/main/java/forestry/core/entities/EntityMinecartContainerForestry.java b/src/main/java/forestry/core/entities/EntityMinecartContainerForestry.java index 7c10e7f33..989e2fa0e 100644 --- a/src/main/java/forestry/core/entities/EntityMinecartContainerForestry.java +++ b/src/main/java/forestry/core/entities/EntityMinecartContainerForestry.java @@ -10,13 +10,14 @@ ******************************************************************************/ package forestry.core.entities; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import forestry.core.inventory.IInventoryAdapter; @@ -69,9 +70,9 @@ public abstract class EntityMinecartContainerForestry extends EntityMinecartFore } @Override - public void travelToDimension(int dimensionId) { - dropContentsWhenDead = false; - super.travelToDimension(dimensionId); + public Entity changeDimension(int dimensionIn) { + this.dropContentsWhenDead = false; + return super.changeDimension(dimensionIn); } /* IInventory */ @@ -121,7 +122,7 @@ public abstract class EntityMinecartContainerForestry extends EntityMinecartFore } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return getInternalInventory().getDisplayName(); } diff --git a/src/main/java/forestry/core/entities/EntityMinecartForestry.java b/src/main/java/forestry/core/entities/EntityMinecartForestry.java index 45dc72c5b..b9465daf3 100644 --- a/src/main/java/forestry/core/entities/EntityMinecartForestry.java +++ b/src/main/java/forestry/core/entities/EntityMinecartForestry.java @@ -17,6 +17,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; @@ -49,8 +50,8 @@ public abstract class EntityMinecartForestry extends EntityMinecart implements I } @Override - public final boolean interactFirst(EntityPlayer player) { - if (MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, player))) { + public boolean processInitialInteract(EntityPlayer player, ItemStack stack, EnumHand hand) { + if (MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, player, stack, hand))) { return true; } @@ -65,7 +66,7 @@ public abstract class EntityMinecartForestry extends EntityMinecart implements I } @Override - public EnumMinecartType getMinecartType() { + public Type getType() { return null; } diff --git a/src/main/java/forestry/core/fluids/BlockForestryFluid.java b/src/main/java/forestry/core/fluids/BlockForestryFluid.java index bd871efb9..5f91dcf01 100644 --- a/src/main/java/forestry/core/fluids/BlockForestryFluid.java +++ b/src/main/java/forestry/core/fluids/BlockForestryFluid.java @@ -19,8 +19,8 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.particle.EntityFX; import net.minecraft.init.Blocks; import net.minecraft.item.Item; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -211,7 +211,7 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR } private static boolean isNearFire(World world, int x, int y, int z) { - AxisAlignedBB boundingBox = AxisAlignedBB.fromBounds(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); + AxisAlignedBB boundingBox = new AxisAlignedBB(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1); return world.isFlammableWithin(boundingBox); } } diff --git a/src/main/java/forestry/core/fluids/tanks/FilteredTank.java b/src/main/java/forestry/core/fluids/tanks/FilteredTank.java index a0bb680c2..60883243c 100644 --- a/src/main/java/forestry/core/fluids/tanks/FilteredTank.java +++ b/src/main/java/forestry/core/fluids/tanks/FilteredTank.java @@ -17,7 +17,7 @@ import java.util.Set; import net.minecraft.item.EnumRarity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -92,7 +92,7 @@ public class FilteredTank extends StandardTank { toolTip.add(fluidFilter.getLocalizedName(filterFluidStack), rarity.rarityColor); } } else { - toolTip.add(EnumChatFormatting.ITALIC + "<" + Translator.translateToLocal("for.gui.tooltip.tmi") + ">"); + toolTip.add(TextFormatting.ITALIC + "<" + Translator.translateToLocal("for.gui.tooltip.tmi") + ">"); } String liquidAmount = Translator.translateToLocalFormatted("for.gui.tooltip.liquid.amount", getFluidAmount(), getCapacity()); diff --git a/src/main/java/forestry/core/genetics/ItemGE.java b/src/main/java/forestry/core/genetics/ItemGE.java index 767bc8177..060c56c9f 100755 --- a/src/main/java/forestry/core/genetics/ItemGE.java +++ b/src/main/java/forestry/core/genetics/ItemGE.java @@ -15,7 +15,7 @@ import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -69,7 +69,7 @@ public abstract class ItemGE extends ItemForestry { if (Proxies.common.isShiftDown()) { individual.addTooltip(list); } else { - list.add(EnumChatFormatting.ITALIC + "<" + Translator.translateToLocal("for.gui.tooltip.tmi") + ">"); + list.add(TextFormatting.ITALIC + "<" + Translator.translateToLocal("for.gui.tooltip.tmi") + ">"); } } else { list.add("<" + Translator.translateToLocal("for.gui.unknown") + ">"); diff --git a/src/main/java/forestry/core/genetics/ItemResearchNote.java b/src/main/java/forestry/core/genetics/ItemResearchNote.java index 7b511a42c..dd19e0db5 100755 --- a/src/main/java/forestry/core/genetics/ItemResearchNote.java +++ b/src/main/java/forestry/core/genetics/ItemResearchNote.java @@ -18,8 +18,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; @@ -100,7 +100,7 @@ public class ItemResearchNote extends ItemForestry { if (encoded.getSpecialConditions() != null && !encoded.getSpecialConditions().isEmpty()) { for (String line : encoded.getSpecialConditions()) { - tooltips.add(EnumChatFormatting.GOLD + line); + tooltips.add(TextFormatting.GOLD + line); } } } else if (this == SPECIES) { @@ -138,7 +138,7 @@ public class ItemResearchNote extends ItemForestry { IBreedingTracker tracker = encoded.getRoot().getBreedingTracker(world, player.getGameProfile()); if (tracker.isResearched(encoded)) { - player.addChatMessage(new ChatComponentTranslation("for.chat.cannotmemorizeagain")); + player.addChatMessage(new TextComponentTranslation("for.chat.cannotmemorizeagain")); return false; } @@ -151,12 +151,12 @@ public class ItemResearchNote extends ItemForestry { tracker.registerSpecies(speciesResult); tracker.researchMutation(encoded); - player.addChatMessage(new ChatComponentTranslation("for.chat.memorizednote")); + player.addChatMessage(new TextComponentTranslation("for.chat.memorizednote")); - player.addChatMessage(new ChatComponentTranslation("for.chat.memorizednote2", - EnumChatFormatting.GRAY + species0.getName(), - EnumChatFormatting.GRAY + species1.getName(), - EnumChatFormatting.GREEN + speciesResult.getName())); + player.addChatMessage(new TextComponentTranslation("for.chat.memorizednote2", + TextFormatting.GRAY + species0.getName(), + TextFormatting.GRAY + species1.getName(), + TextFormatting.GREEN + speciesResult.getName())); return true; } @@ -242,7 +242,7 @@ public class ItemResearchNote extends ItemForestry { public void addTooltip(List list) { ArrayList tooltips = type.getTooltip(inner); if (tooltips.size() <= 0) { - list.add(EnumChatFormatting.ITALIC + EnumChatFormatting.RED.toString() + Translator.translateToLocal("for.researchNote.error.0")); + list.add(TextFormatting.ITALIC + TextFormatting.RED.toString() + Translator.translateToLocal("for.researchNote.error.0")); list.add(Translator.translateToLocal("for.researchNote.error.1")); return; } diff --git a/src/main/java/forestry/core/genetics/mutations/Mutation.java b/src/main/java/forestry/core/genetics/mutations/Mutation.java index f185bd006..fa55ba242 100644 --- a/src/main/java/forestry/core/genetics/mutations/Mutation.java +++ b/src/main/java/forestry/core/genetics/mutations/Mutation.java @@ -15,7 +15,7 @@ import java.util.Collection; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.BiomeDictionary; diff --git a/src/main/java/forestry/core/genetics/mutations/MutationConditionBiome.java b/src/main/java/forestry/core/genetics/mutations/MutationConditionBiome.java index 0787e95a1..3a2ae72ea 100644 --- a/src/main/java/forestry/core/genetics/mutations/MutationConditionBiome.java +++ b/src/main/java/forestry/core/genetics/mutations/MutationConditionBiome.java @@ -14,7 +14,7 @@ import java.util.Arrays; import java.util.List; import java.util.Locale; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/core/genetics/mutations/MutationConditionDaytime.java b/src/main/java/forestry/core/genetics/mutations/MutationConditionDaytime.java index 0198dadde..7147d5ccf 100644 --- a/src/main/java/forestry/core/genetics/mutations/MutationConditionDaytime.java +++ b/src/main/java/forestry/core/genetics/mutations/MutationConditionDaytime.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.core.genetics.mutations; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.genetics.IAllele; diff --git a/src/main/java/forestry/core/genetics/mutations/MutationConditionHumidity.java b/src/main/java/forestry/core/genetics/mutations/MutationConditionHumidity.java index 21bcc64b3..66583704a 100644 --- a/src/main/java/forestry/core/genetics/mutations/MutationConditionHumidity.java +++ b/src/main/java/forestry/core/genetics/mutations/MutationConditionHumidity.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.core.genetics.mutations; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/core/genetics/mutations/MutationConditionRequiresResource.java b/src/main/java/forestry/core/genetics/mutations/MutationConditionRequiresResource.java index 1c636d90e..3ba656d0f 100644 --- a/src/main/java/forestry/core/genetics/mutations/MutationConditionRequiresResource.java +++ b/src/main/java/forestry/core/genetics/mutations/MutationConditionRequiresResource.java @@ -12,7 +12,7 @@ package forestry.core.genetics.mutations; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.apiculture.IBeeHousing; diff --git a/src/main/java/forestry/core/genetics/mutations/MutationConditionRequiresResourceOreDict.java b/src/main/java/forestry/core/genetics/mutations/MutationConditionRequiresResourceOreDict.java index 2ad9368d1..e89b5efe2 100644 --- a/src/main/java/forestry/core/genetics/mutations/MutationConditionRequiresResourceOreDict.java +++ b/src/main/java/forestry/core/genetics/mutations/MutationConditionRequiresResourceOreDict.java @@ -14,7 +14,7 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; diff --git a/src/main/java/forestry/core/genetics/mutations/MutationConditionTemperature.java b/src/main/java/forestry/core/genetics/mutations/MutationConditionTemperature.java index 46c9ba488..c819d2646 100644 --- a/src/main/java/forestry/core/genetics/mutations/MutationConditionTemperature.java +++ b/src/main/java/forestry/core/genetics/mutations/MutationConditionTemperature.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.core.genetics.mutations; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/core/genetics/mutations/MutationConditionTimeLimited.java b/src/main/java/forestry/core/genetics/mutations/MutationConditionTimeLimited.java index 8bd8c74fd..f2dff3cde 100644 --- a/src/main/java/forestry/core/genetics/mutations/MutationConditionTimeLimited.java +++ b/src/main/java/forestry/core/genetics/mutations/MutationConditionTimeLimited.java @@ -12,7 +12,7 @@ package forestry.core.genetics.mutations; import java.util.Calendar; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.genetics.IAllele; diff --git a/src/main/java/forestry/core/gui/GuiEscritoire.java b/src/main/java/forestry/core/gui/GuiEscritoire.java index c9c5d28f6..6f8cebf74 100755 --- a/src/main/java/forestry/core/gui/GuiEscritoire.java +++ b/src/main/java/forestry/core/gui/GuiEscritoire.java @@ -14,7 +14,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import forestry.core.config.Constants; import forestry.core.gui.widgets.GameTokenWidget; @@ -91,7 +91,7 @@ public class GuiEscritoire extends GuiForestry ext this.zLevel = level; } - public static RenderItem getItemRenderer() { - return Proxies.common.getClientInstance().getRenderItem(); - } - public int getSizeX() { return xSize; } diff --git a/src/main/java/forestry/core/gui/GuiHandler.java b/src/main/java/forestry/core/gui/GuiHandler.java index b75956bee..b4c87174e 100644 --- a/src/main/java/forestry/core/gui/GuiHandler.java +++ b/src/main/java/forestry/core/gui/GuiHandler.java @@ -15,7 +15,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.IGuiHandler; diff --git a/src/main/java/forestry/core/gui/GuiUtil.java b/src/main/java/forestry/core/gui/GuiUtil.java index 24cb69128..478e01d3e 100644 --- a/src/main/java/forestry/core/gui/GuiUtil.java +++ b/src/main/java/forestry/core/gui/GuiUtil.java @@ -16,13 +16,14 @@ import java.util.List; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.RenderItem; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.config.GuiUtils; import forestry.core.gui.tooltips.IToolTipProvider; import forestry.core.gui.tooltips.ToolTip; +import forestry.core.proxy.Proxies; public class GuiUtil { public static void drawItemStack(GuiForestry gui, ItemStack stack, int xPos, int yPos) { @@ -34,7 +35,7 @@ public class GuiUtil { font = gui.getFontRenderer(); } - RenderItem itemRender = GuiForestry.getItemRenderer(); + RenderItem itemRender = Proxies.common.getClientInstance().getRenderItem(); itemRender.renderItemAndEffectIntoGUI(stack, xPos, yPos); itemRender.renderItemOverlayIntoGUI(font, stack, xPos, yPos, null); } diff --git a/src/main/java/forestry/core/gui/ledgers/Ledger.java b/src/main/java/forestry/core/gui/ledgers/Ledger.java index bdbd06379..b0127f550 100644 --- a/src/main/java/forestry/core/gui/ledgers/Ledger.java +++ b/src/main/java/forestry/core/gui/ledgers/Ledger.java @@ -216,7 +216,7 @@ public abstract class Ledger { protected void drawSprite(TextureAtlasSprite sprite, int x, int y) { if (sprite != null) { GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0F); - Proxies.render.bindTexture(TextureMap.locationBlocksTexture); + Proxies.render.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); manager.gui.drawTexturedModalRect(x, y, sprite, 16, 16); } } diff --git a/src/main/java/forestry/core/gui/tooltips/ToolTip.java b/src/main/java/forestry/core/gui/tooltips/ToolTip.java index 2f8a0764c..adbfc344c 100755 --- a/src/main/java/forestry/core/gui/tooltips/ToolTip.java +++ b/src/main/java/forestry/core/gui/tooltips/ToolTip.java @@ -16,7 +16,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; /** * @author CovertJaguar @@ -43,7 +43,7 @@ public class ToolTip { return add(line, null); } - public boolean add(@Nonnull String line, @Nullable EnumChatFormatting formatting) { + public boolean add(@Nonnull String line, @Nullable TextFormatting formatting) { if (formatting != null) { return lines.add(formatting + line); } else { diff --git a/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java b/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java index 3505983bd..468312c99 100644 --- a/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java +++ b/src/main/java/forestry/core/gui/widgets/GameTokenWidget.java @@ -70,7 +70,7 @@ public class GameTokenWidget extends Widget { GlStateManager.disableDepth(); for (String ident : getToken().getOverlayIcons()) { - Proxies.render.bindTexture(TextureMap.locationBlocksTexture); + Proxies.render.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); TextureAtlasSprite icon = TextureManager.getInstance().getDefault(ident); manager.gui.drawTexturedModalRect(startX + xPos + 3, startY + yPos + 3, icon, 16, 16); } diff --git a/src/main/java/forestry/core/gui/widgets/SocketWidget.java b/src/main/java/forestry/core/gui/widgets/SocketWidget.java index f60ae4787..b82b1b5f3 100755 --- a/src/main/java/forestry/core/gui/widgets/SocketWidget.java +++ b/src/main/java/forestry/core/gui/widgets/SocketWidget.java @@ -14,12 +14,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import forestry.core.circuits.ISocketable; import forestry.core.circuits.ISolderingIron; import forestry.core.circuits.ItemCircuitBoard; -import forestry.core.gui.GuiForestry; import forestry.core.gui.IContainerSocketed; import forestry.core.gui.tooltips.ToolTip; import forestry.core.proxy.Proxies; @@ -40,7 +39,7 @@ public class SocketWidget extends Widget { public void draw(int startX, int startY) { ItemStack socketStack = tile.getSocket(slot); if (socketStack != null) { - GuiForestry.getItemRenderer().renderItemIntoGUI(socketStack, startX + xPos, startY + yPos); + Proxies.common.getClientInstance().getRenderItem().renderItemIntoGUI(socketStack, startX + xPos, startY + yPos); } } @@ -57,7 +56,7 @@ public class SocketWidget extends Widget { if (stack != null) { EntityPlayer player = Proxies.common.getClientInstance().thePlayer; toolTip.add(stack.getTooltip(player, false)); - toolTip.add(EnumChatFormatting.ITALIC + Translator.translateToLocal("for.gui.socket.remove")); + toolTip.add(TextFormatting.ITALIC + Translator.translateToLocal("for.gui.socket.remove")); } else { toolTip.add(Translator.translateToLocal("for.gui.emptysocket")); } diff --git a/src/main/java/forestry/core/gui/widgets/TankWidget.java b/src/main/java/forestry/core/gui/widgets/TankWidget.java index 90af30e4b..127be6edd 100755 --- a/src/main/java/forestry/core/gui/widgets/TankWidget.java +++ b/src/main/java/forestry/core/gui/widgets/TankWidget.java @@ -13,7 +13,7 @@ package forestry.core.gui.widgets; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; @@ -22,6 +22,7 @@ import net.minecraft.inventory.Container; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidTank; @@ -106,7 +107,7 @@ public class TankWidget extends Widget { scaledAmount = height; } - Proxies.render.bindTexture(TextureMap.locationBlocksTexture); + Proxies.render.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); setGLColorFromInt(fluidColor); final int xTileCount = width / 16; @@ -168,12 +169,12 @@ public class TankWidget extends Widget { vMax = vMax - maskTop / 16.0 * (vMax - vMin); Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex(); - worldrenderer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex(); - worldrenderer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex(); - worldrenderer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex(); + VertexBuffer vertexBuffer = tessellator.getBuffer(); + vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX); + vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex(); + vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex(); + vertexBuffer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex(); + vertexBuffer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex(); tessellator.draw(); } diff --git a/src/main/java/forestry/core/inventory/FakeInventoryAdapter.java b/src/main/java/forestry/core/inventory/FakeInventoryAdapter.java index 2c42cda93..c23d70dc6 100644 --- a/src/main/java/forestry/core/inventory/FakeInventoryAdapter.java +++ b/src/main/java/forestry/core/inventory/FakeInventoryAdapter.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; import forestry.core.config.Constants; @@ -84,7 +84,7 @@ public class FakeInventoryAdapter implements IInventoryAdapter { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/forestry/core/inventory/InventoryAdapter.java b/src/main/java/forestry/core/inventory/InventoryAdapter.java index 71e5fb01f..168eeb700 100755 --- a/src/main/java/forestry/core/inventory/InventoryAdapter.java +++ b/src/main/java/forestry/core/inventory/InventoryAdapter.java @@ -17,7 +17,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; import forestry.core.config.Constants; import forestry.core.network.DataInputStreamForestry; @@ -126,7 +126,7 @@ public class InventoryAdapter implements IInventoryAdapter, IStreamable { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/forestry/core/inventory/InventoryPlain.java b/src/main/java/forestry/core/inventory/InventoryPlain.java index 90322f1ed..828e73d63 100644 --- a/src/main/java/forestry/core/inventory/InventoryPlain.java +++ b/src/main/java/forestry/core/inventory/InventoryPlain.java @@ -14,8 +14,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; import forestry.api.core.INbtReadable; import forestry.api.core.INbtWritable; @@ -118,8 +118,8 @@ public class InventoryPlain implements IInventory, INbtWritable, INbtReadable { } @Override - public IChatComponent getDisplayName() { - return new ChatComponentText(getName()); + public ITextComponent getDisplayName() { + return new TextComponentString(getName()); } @Override diff --git a/src/main/java/forestry/core/inventory/ItemInventory.java b/src/main/java/forestry/core/inventory/ItemInventory.java index 29ab455b2..cdbf4fe5d 100755 --- a/src/main/java/forestry/core/inventory/ItemInventory.java +++ b/src/main/java/forestry/core/inventory/ItemInventory.java @@ -16,9 +16,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.EnumHand; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; @@ -77,9 +78,11 @@ public abstract class ItemInventory implements IInventory, IFilterSlotDelegate, } protected ItemStack getParent() { - ItemStack equipped = player.getCurrentEquippedItem(); - if (isSameItemInventory(equipped, parent)) { - return equipped; + for (EnumHand hand : EnumHand.values()) { + ItemStack held = player.getHeldItem(hand); + if (isSameItemInventory(held, parent)) { + return held; + } } return parent; } @@ -218,8 +221,8 @@ public abstract class ItemInventory implements IInventory, IFilterSlotDelegate, } @Override - public IChatComponent getDisplayName() { - return new ChatComponentText(getName()); + public ITextComponent getDisplayName() { + return new TextComponentString(getName()); } @Override diff --git a/src/main/java/forestry/core/inventory/wrappers/ChestWrapper.java b/src/main/java/forestry/core/inventory/wrappers/ChestWrapper.java index a637e9836..e3d2c6883 100755 --- a/src/main/java/forestry/core/inventory/wrappers/ChestWrapper.java +++ b/src/main/java/forestry/core/inventory/wrappers/ChestWrapper.java @@ -80,7 +80,7 @@ public class ChestWrapper implements IInventory { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/forestry/core/inventory/wrappers/InvWrapperBase.java b/src/main/java/forestry/core/inventory/wrappers/InvWrapperBase.java index 9cdecb202..72a758298 100644 --- a/src/main/java/forestry/core/inventory/wrappers/InvWrapperBase.java +++ b/src/main/java/forestry/core/inventory/wrappers/InvWrapperBase.java @@ -13,7 +13,7 @@ package forestry.core.inventory.wrappers; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; /** * Created by CovertJaguar on 3/6/2016 for Railcraft. @@ -67,7 +67,7 @@ public abstract class InvWrapperBase implements IInventory { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return inv.getDisplayName(); } diff --git a/src/main/java/forestry/core/items/ItemBlockForestry.java b/src/main/java/forestry/core/items/ItemBlockForestry.java index 7fa739f61..a11c7bc9a 100644 --- a/src/main/java/forestry/core/items/ItemBlockForestry.java +++ b/src/main/java/forestry/core/items/ItemBlockForestry.java @@ -15,7 +15,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/core/items/ItemCrated.java b/src/main/java/forestry/core/items/ItemCrated.java index a4fba82a7..04a69836b 100755 --- a/src/main/java/forestry/core/items/ItemCrated.java +++ b/src/main/java/forestry/core/items/ItemCrated.java @@ -10,11 +10,14 @@ ******************************************************************************/ package forestry.core.items; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; @@ -45,19 +48,19 @@ public class ItemCrated extends ItemForestry { } @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { - if (!world.isRemote) { - if (contained == null || itemstack.stackSize == 0) { - return itemstack; + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { + if (!worldIn.isRemote) { + if (contained == null || itemStackIn.stackSize == 0) { + return ActionResult.newResult(EnumActionResult.PASS, itemStackIn); } - itemstack.stackSize--; + itemStackIn.stackSize--; ItemStack dropStack = contained.copy(); dropStack.stackSize = 9; - ItemStackUtil.dropItemStackAsEntity(dropStack, world, entityplayer.posX, entityplayer.posY, entityplayer.posZ, 40); + ItemStackUtil.dropItemStackAsEntity(dropStack, worldIn, playerIn.posX, playerIn.posY, playerIn.posZ, 40); } - return itemstack; + return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn); } @Override @@ -83,13 +86,14 @@ public class ItemCrated extends ItemForestry { ModelBakery.registerItemVariants(item, modelLocation); } } - - @Override - public int getColorFromItemStack(ItemStack stack, int renderPass) { - if (getContained() == null || renderPass == 100) { - return super.getColorFromItemStack(stack, renderPass); - } - return getContained().getItem().getColorFromItemStack(getContained(), renderPass); - } + + // TODO: crate rendering +// @Override +// public int getColorFromItemStack(ItemStack stack, int renderPass) { +// if (getContained() == null || renderPass == 100) { +// return super.getColorFromItemStack(stack, renderPass); +// } +// return getContained().getItem().getColorFromItemStack(getContained(), renderPass); +// } } diff --git a/src/main/java/forestry/core/items/ItemElectronTube.java b/src/main/java/forestry/core/items/ItemElectronTube.java index 001b00d11..2b5ed5bd5 100644 --- a/src/main/java/forestry/core/items/ItemElectronTube.java +++ b/src/main/java/forestry/core/items/ItemElectronTube.java @@ -20,7 +20,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import forestry.api.circuits.ChipsetManager; import forestry.api.circuits.ICircuit; @@ -44,13 +44,13 @@ public class ItemElectronTube extends ItemOverlay { if (Proxies.common.isShiftDown()) { for (ICircuitLayout circuitLayout : circuits.keys()) { String circuitLayoutName = circuitLayout.getUsage(); - list.add(EnumChatFormatting.WHITE.toString() + EnumChatFormatting.UNDERLINE + circuitLayoutName); + list.add(TextFormatting.WHITE.toString() + TextFormatting.UNDERLINE + circuitLayoutName); for (ICircuit circuit : circuits.get(circuitLayout)) { circuit.addTooltip(list); } } } else { - list.add(EnumChatFormatting.ITALIC + "<" + Translator.translateToLocal("for.gui.tooltip.tmi") + ">"); + list.add(TextFormatting.ITALIC + "<" + Translator.translateToLocal("for.gui.tooltip.tmi") + ">"); } } else { list.add("<" + Translator.translateToLocal("for.gui.noeffect") + ">"); diff --git a/src/main/java/forestry/core/items/ItemForestryBonemeal.java b/src/main/java/forestry/core/items/ItemForestryBonemeal.java index ecb79f918..bda98c33e 100644 --- a/src/main/java/forestry/core/items/ItemForestryBonemeal.java +++ b/src/main/java/forestry/core/items/ItemForestryBonemeal.java @@ -13,7 +13,7 @@ package forestry.core.items; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/core/items/ItemForestryTool.java b/src/main/java/forestry/core/items/ItemForestryTool.java index ddd7809cf..901f11937 100755 --- a/src/main/java/forestry/core/items/ItemForestryTool.java +++ b/src/main/java/forestry/core/items/ItemForestryTool.java @@ -15,7 +15,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/forestry/core/items/ItemLiquidContainer.java b/src/main/java/forestry/core/items/ItemLiquidContainer.java index 96a671909..849b44861 100755 --- a/src/main/java/forestry/core/items/ItemLiquidContainer.java +++ b/src/main/java/forestry/core/items/ItemLiquidContainer.java @@ -17,9 +17,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidRegistry; @@ -67,66 +69,63 @@ public class ItemLiquidContainer extends ItemForestry { } @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { - - if (world.isRemote) { - return itemstack; + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { + if (worldIn.isRemote) { + return ActionResult.newResult(EnumActionResult.PASS, itemStackIn); } - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, entityplayer, true); - if (movingobjectposition != null && movingobjectposition.typeOfHit == MovingObjectType.BLOCK) { - - BlockPos pos = movingobjectposition.getBlockPos(); - Block targetedBlock = world.getBlockState(pos).getBlock(); - - FluidStack fluid = null; - - if (targetedBlock instanceof IFluidBlock) { - fluid = ((IFluidBlock) targetedBlock).drain(world, pos, false); - } else { - if (targetedBlock == Blocks.water || targetedBlock == Blocks.flowing_water) { - fluid = new FluidStack(FluidRegistry.WATER, 1000); - } else if (targetedBlock == Blocks.lava || targetedBlock == Blocks.flowing_lava) { - fluid = new FluidStack(FluidRegistry.LAVA, 1000); - } - } - - ItemStack filledContainer = FluidHelper.getFilledContainer(fluid.getFluid(), itemstack); - if (filledContainer == null) { - return itemstack; - } - - // Search for a slot to stow a filled container in player's - // inventory - int slot = getMatchingSlot(entityplayer, filledContainer); - if (slot < 0) { - return itemstack; - } - - if (entityplayer.inventory.getStackInSlot(slot) == null) { - entityplayer.inventory.setInventorySlotContents(slot, filledContainer.copy()); - } else { - entityplayer.inventory.getStackInSlot(slot).stackSize++; - } - - // Remove consumed liquid block in world - if (targetedBlock instanceof IFluidBlock) { - ((IFluidBlock) targetedBlock).drain(world, pos, true); - } else { - world.setBlockToAir(pos); - } - - // Remove consumed empty container - itemstack.stackSize--; - - // Notify player that his inventory has changed. - Proxies.net.inventoryChangeNotify(entityplayer); - - return itemstack; + RayTraceResult rayTraceResult = this.rayTrace(worldIn, playerIn, true); + if (rayTraceResult == null || rayTraceResult.typeOfHit != RayTraceResult.Type.BLOCK) { + return ActionResult.newResult(EnumActionResult.PASS, itemStackIn); } - return itemstack; + BlockPos pos = rayTraceResult.getBlockPos(); + Block targetedBlock = worldIn.getBlockState(pos).getBlock(); + FluidStack fluid = null; + + if (targetedBlock instanceof IFluidBlock) { + fluid = ((IFluidBlock) targetedBlock).drain(worldIn, pos, false); + } else { + if (targetedBlock == Blocks.WATER || targetedBlock == Blocks.FLOWING_WATER) { + fluid = new FluidStack(FluidRegistry.WATER, 1000); + } else if (targetedBlock == Blocks.LAVA || targetedBlock == Blocks.FLOWING_LAVA) { + fluid = new FluidStack(FluidRegistry.LAVA, 1000); + } + } + + ItemStack filledContainer = FluidHelper.getFilledContainer(fluid.getFluid(), itemStackIn); + if (filledContainer == null) { + return ActionResult.newResult(EnumActionResult.FAIL, itemStackIn); + } + + // Search for a slot to stow a filled container in player's + // inventory + int slot = getMatchingSlot(playerIn, filledContainer); + if (slot < 0) { + return ActionResult.newResult(EnumActionResult.FAIL, itemStackIn); + } + + if (playerIn.inventory.getStackInSlot(slot) == null) { + playerIn.inventory.setInventorySlotContents(slot, filledContainer.copy()); + } else { + playerIn.inventory.getStackInSlot(slot).stackSize++; + } + + // Remove consumed liquid block in world + if (targetedBlock instanceof IFluidBlock) { + ((IFluidBlock) targetedBlock).drain(worldIn, pos, true); + } else { + worldIn.setBlockToAir(pos); + } + + // Remove consumed empty container + itemStackIn.stackSize--; + + // Notify player that his inventory has changed. + Proxies.net.inventoryChangeNotify(playerIn); + + return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn); } /* Models */ @@ -140,14 +139,15 @@ public class ItemLiquidContainer extends ItemForestry { } } - @Override - public int getColorFromItemStack(ItemStack itemstack, int j) { - if (j > 0) { - return color; - } else { - return 0xffffff; - } - } + // TODO: liquid container coloring +// @Override +// public int getColorFromItemStack(ItemStack itemstack, int j) { +// if (j > 0) { +// return color; +// } else { +// return 0xffffff; +// } +// } public EnumContainerType getType() { return type; diff --git a/src/main/java/forestry/core/items/ItemPipette.java b/src/main/java/forestry/core/items/ItemPipette.java index 4a668bbf8..6462e69bf 100755 --- a/src/main/java/forestry/core/items/ItemPipette.java +++ b/src/main/java/forestry/core/items/ItemPipette.java @@ -13,7 +13,7 @@ package forestry.core.items; import java.util.List; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/forestry/core/items/ItemWrench.java b/src/main/java/forestry/core/items/ItemWrench.java index 692241225..527339a30 100755 --- a/src/main/java/forestry/core/items/ItemWrench.java +++ b/src/main/java/forestry/core/items/ItemWrench.java @@ -14,7 +14,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/core/models/BlankItemModel.java b/src/main/java/forestry/core/models/BlankItemModel.java index ffb2dc9b9..374151ef2 100644 --- a/src/main/java/forestry/core/models/BlankItemModel.java +++ b/src/main/java/forestry/core/models/BlankItemModel.java @@ -12,24 +12,19 @@ package forestry.core.models; import java.util.List; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.ISmartItemModel; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public abstract class BlankItemModel implements ISmartItemModel { - +public abstract class BlankItemModel implements IBakedModel { @Override - public List getFaceQuads(EnumFacing facing) { - return null; - } - - @Override - public List getGeneralQuads() { + public List getQuads(IBlockState state, EnumFacing side, long rand) { return null; } diff --git a/src/main/java/forestry/core/models/BlockModelIndex.java b/src/main/java/forestry/core/models/BlockModelIndex.java index d24d4a593..9eacc7ef4 100644 --- a/src/main/java/forestry/core/models/BlockModelIndex.java +++ b/src/main/java/forestry/core/models/BlockModelIndex.java @@ -11,8 +11,8 @@ package forestry.core.models; import net.minecraft.block.Block; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; public class BlockModelIndex { diff --git a/src/main/java/forestry/core/models/ModelBlockOverlay.java b/src/main/java/forestry/core/models/ModelBlockOverlay.java index 0ff8c5bcf..74938834b 100644 --- a/src/main/java/forestry/core/models/ModelBlockOverlay.java +++ b/src/main/java/forestry/core/models/ModelBlockOverlay.java @@ -17,19 +17,17 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; -import net.minecraftforge.client.model.IFlexibleBakedModel; -import net.minecraftforge.client.model.ISmartBlockModel; -import net.minecraftforge.client.model.ISmartItemModel; import net.minecraftforge.common.property.IExtendedBlockState; import forestry.api.core.IModelBaker; @@ -41,7 +39,8 @@ import forestry.core.models.baker.ModelBaker; /** * A overlay block model to make a block with 2 or more texture layers */ -public abstract class ModelBlockOverlay implements IFlexibleBakedModel, ISmartItemModel, ISmartBlockModel { +public abstract class ModelBlockOverlay implements IBakedModel { + private ItemOverrideList overrideList; @Nonnull protected final Class blockClass; protected IModelBakerModel latestBlockModel; @@ -52,13 +51,23 @@ public abstract class ModelBlockOverlay implements IFlexibleBak } @Override - public List getFaceQuads(EnumFacing face) { - return Collections.emptyList(); - } + public List getQuads(IBlockState state, EnumFacing side, long rand) { + IModelBaker baker = new ModelBaker(); + IExtendedBlockState stateExtended = (IExtendedBlockState) state; - @Override - public List getGeneralQuads() { - return Collections.emptyList(); + IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS); + BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS); + Block block = state.getBlock(); + if (!blockClass.isInstance(block)) { + return null; + } + B bBlock = blockClass.cast(block); + + baker.setRenderBoundsFromBlock(block); + bakeWorldBlock(bBlock, world, pos, stateExtended, baker); + + latestBlockModel = baker.bakeModel(false); + return latestBlockModel.getQuads(state, side, rand); } @Override @@ -98,51 +107,48 @@ public abstract class ModelBlockOverlay implements IFlexibleBak return latestItemModel.getItemCameraTransforms(); } - @Override - public VertexFormat getFormat() { - if(latestItemModel == null && latestBlockModel == null) { - return DefaultVertexFormats.BLOCK; - } - return latestBlockModel != null ? latestBlockModel.getFormat() : latestItemModel.getFormat(); +// @Override +// public VertexFormat getFormat() { +// if(latestItemModel == null && latestBlockModel == null) { +// return DefaultVertexFormats.BLOCK; +// } +// return latestBlockModel != null ? latestBlockModel.getFormat() : latestItemModel.getFormat(); +// } + + protected ItemOverrideList createOverrides() { + return new OverlayItemOverrideList(); } @Override - public IBakedModel handleBlockState(IBlockState state) { - IModelBaker baker = new ModelBaker(); - IExtendedBlockState stateExtended = (IExtendedBlockState) state; - - IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS); - BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS); - Block block = state.getBlock(); - if (!blockClass.isInstance(block)) { - return null; + public ItemOverrideList getOverrides() { + if (overrideList == null) { + overrideList = createOverrides(); } - B bBlock = blockClass.cast(block); - - baker.setRenderBoundsFromBlock(block); - bakeWorldBlock(bBlock, world, pos, stateExtended, baker); - - return latestBlockModel = baker.bakeModel(false); + return overrideList; } - @Override - public IBakedModel handleItemState(ItemStack stack) { - IModelBaker baker = new ModelBaker(); - Block block = Block.getBlockFromItem(stack.getItem()); - if (!blockClass.isInstance(block)) { - return null; - } - B bBlock = blockClass.cast(block); - - block.setBlockBoundsForItemRender(); - baker.setRenderBoundsFromBlock(block); - bakeInventoryBlock(bBlock, stack, baker); - - return latestItemModel = baker.bakeModel(true); - } - protected abstract void bakeInventoryBlock(@Nonnull B block, @Nonnull ItemStack item, @Nonnull IModelBaker baker); protected abstract void bakeWorldBlock(@Nonnull B block, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IExtendedBlockState stateExtended, @Nonnull IModelBaker baker); + private class OverlayItemOverrideList extends ItemOverrideList { + public OverlayItemOverrideList() { + super(Collections.emptyList()); + } + + @Override + public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { + IModelBaker baker = new ModelBaker(); + Block block = Block.getBlockFromItem(stack.getItem()); + if (!blockClass.isInstance(block)) { + return null; + } + B bBlock = blockClass.cast(block); + + baker.setRenderBoundsFromBlock(block); + bakeInventoryBlock(bBlock, stack, baker); + + return latestItemModel = baker.bakeModel(true); + } + } } diff --git a/src/main/java/forestry/core/models/ModelCrate.java b/src/main/java/forestry/core/models/ModelCrate.java index 79392e8f6..e2fe7dc9b 100644 --- a/src/main/java/forestry/core/models/ModelCrate.java +++ b/src/main/java/forestry/core/models/ModelCrate.java @@ -1,239 +1,241 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ -package forestry.core.models; +// TODO: fix crate rendering -import com.google.common.base.Charsets; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; - -import javax.vecmath.Vector3f; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.StringReader; -import java.util.IdentityHashMap; -import java.util.Map; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.block.model.ModelBlock; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.IResource; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -import net.minecraftforge.client.ItemModelMesherForge; -import net.minecraftforge.client.event.ModelBakeEvent; -import net.minecraftforge.client.model.IFlexibleBakedModel; -import net.minecraftforge.client.model.IModel; -import net.minecraftforge.client.model.IModelState; -import net.minecraftforge.client.model.IPerspectiveAwareModel; -import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.client.model.MultiModel; -import net.minecraftforge.client.model.SimpleModelState; -import net.minecraftforge.client.model.TRSRTransformation; -import net.minecraftforge.fml.common.ObfuscationReflectionHelper; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import forestry.core.items.ItemCrated; -import forestry.core.utils.ItemStackUtil; -import forestry.core.utils.Log; -import forestry.storage.PluginStorage; - -import gnu.trove.map.hash.TIntObjectHashMap; - -@SideOnly(Side.CLIENT) -public class ModelCrate extends BlankItemModel { - - private final Map crates = Maps.newHashMap(); - - private static IModel crateModel; - private static ModelBlock MODEL_GENERATED; - private static ModelBlock MODEL_COMPASS; - private static ModelBlock MODEL_CLOCK; - - /** - * Init the model - */ - public static void initModel(ModelBakeEvent event){ - try { - crateModel = ModelLoaderRegistry.getModel(new ModelResourceLocation("forestry:crate-filled", "inventory")); - MODEL_GENERATED = ObfuscationReflectionHelper.getPrivateValue(ModelBakery.class, event.modelLoader, 14); - MODEL_COMPASS = ObfuscationReflectionHelper.getPrivateValue(ModelBakery.class, event.modelLoader, 15); - MODEL_CLOCK = ObfuscationReflectionHelper.getPrivateValue(ModelBakery.class, event.modelLoader, 16); - } catch (IOException e) { - Log.error("Failed to init the crate model.", e); - } - } - - /** - * Bake the crate content models - */ - private ImmutableMap bakeContentModels(ItemCrated crateItem) { - ImmutableMap.Builder pb = ImmutableMap.builder(); - - IFlexibleBakedModel containedModel = getModel(crateItem.getContained()); - - IdentityHashMap> modelResourceLocations = ObfuscationReflectionHelper.getPrivateValue(ItemModelMesherForge.class, (ItemModelMesherForge) Minecraft.getMinecraft().getRenderItem().getItemModelMesher(), 0); - - ModelResourceLocation modelResource = modelResourceLocations.get(crateItem.getContained().getItem()).get(crateItem.getContained().getItemDamage()); - ResourceLocation location = getItemLocation(modelResource); - - if (hasItemModel(location)) { - pb.put(String.valueOf(0), new TRSRBakedModel(containedModel, -0.0625F, 0, 0.0625F, 0.5F)); - pb.put(String.valueOf(1), new TRSRBakedModel(containedModel, -0.0625F, 0, -0.0625F, 0.5F)); - } else { - pb.put(String.valueOf(0), new TRSRBakedModel(containedModel, -0.0625F, 0, 0, 0.5F)); - } - return pb.build(); - } - - /** - * @return The item model {@link ResourceLocation} from a {@link ModelResourceLocation} - */ - private ResourceLocation getItemLocation(ModelResourceLocation modelResource) { - ResourceLocation resourcelocation = new ResourceLocation(modelResource.toString().replaceAll("#.*", "")); - return new ResourceLocation(resourcelocation.getResourceDomain(), "item/" + resourcelocation.getResourcePath()); - } - - /** - * @return Return true, when the model a item model is - */ - private boolean hasItemModel(ResourceLocation location) { - try { - ModelBlock modelBlock = loadModel(location); - if (modelBlock == null) { - return false; - } else { - ModelBlock rootModelBlock = modelBlock.getRootModel(); - return rootModelBlock == MODEL_GENERATED || rootModelBlock == MODEL_COMPASS || rootModelBlock == MODEL_CLOCK; - } - } catch (IOException e) { - return false; - } - } - - private ModelBlock loadModel(ResourceLocation location) throws IOException { - String s = location.getResourcePath(); - - if ("builtin/generated".equals(s)) { - return MODEL_GENERATED; - } else if ("builtin/compass".equals(s)) { - return MODEL_COMPASS; - } else if ("builtin/clock".equals(s)) { - return MODEL_CLOCK; - } else { - Reader reader; - - if (s.startsWith("builtin/")) { - String s1 = s.substring("builtin/".length()); - if (s1.equals("missing")) { - reader = new StringReader("{ \"textures\": { \"particle\": \"missingno\", \"missingno\": \"missingno\"}, \"elements\": [ { \"from\": [ 0, 0, 0 ], \"to\": [ 16, 16, 16 ], \"faces\": { \"down\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"down\", \"texture\": \"#missingno\" }, \"up\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"up\", \"texture\": \"#missingno\" }, \"north\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"north\", \"texture\": \"#missingno\" }, \"south\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"south\", \"texture\": \"#missingno\" }, \"west\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"west\", \"texture\": \"#missingno\" }, \"east\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"east\", \"texture\": \"#missingno\" } }}]}"); - } else { - throw new FileNotFoundException(location.toString()); - } - } else { - IResource iresource = Minecraft.getMinecraft().getResourceManager().getResource(this.getModelLocation(location)); - reader = new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8); - } - - ModelBlock model; - - try { - ModelBlock modelblock = ModelBlock.deserialize(reader); - modelblock.name = location.toString(); - model = modelblock; - } finally { - try { - reader.close(); - } catch (IOException e) { - Log.error("Failed to close crate model reader.", e); - } - } - - if (model != null && model.getParentLocation() != null) { - if (model.getParentLocation().getResourcePath().equals("builtin/generated")) { - model.parent = MODEL_GENERATED; - } else { - try { - model.parent = loadModel(model.getParentLocation()); - } catch (IOException e) { - Log.error("Failed to load model.", e); - } - } - } - - return model; - } - } - - private ResourceLocation getModelLocation(ResourceLocation resourceLocation) { - return new ResourceLocation(resourceLocation.getResourceDomain(), "models/" + resourceLocation.getResourcePath() + ".json"); - } - - /** - * @return The baked model from the filled crate - */ - private IFlexibleBakedModel getModel(ItemStack stack) { - IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(stack); - if (model == null) { - return null; - } else if (model instanceof IFlexibleBakedModel) { - return (IFlexibleBakedModel) model; - } else { - return new IFlexibleBakedModel.Wrapper(model, DefaultVertexFormats.ITEM); - } - } - - /** - * Bake the crated model - */ - @Override - public IBakedModel handleItemState(ItemStack stack) { - ItemCrated crated = (ItemCrated) stack.getItem(); - String crateUID = ItemStackUtil.getItemNameFromRegistry(crated).getResourcePath(); - if (crates.get(crateUID) == null) { - IFlexibleBakedModel baseBaked = getModel(new ItemStack(PluginStorage.items.crate, 1, 1)); - //Set the crate color index to 100 - for (BakedQuad quad : baseBaked.getGeneralQuads()) { - ObfuscationReflectionHelper.setPrivateValue(BakedQuad.class, quad, 100, 1); - } - crates.put(crateUID, new MultiModel.Baked(null, true, new IPerspectiveAwareModel.MapWrapper(baseBaked, getTransformations()), bakeContentModels(crated))); - } - return crates.get(crateUID); - } - - public static IModelState getTransformations() { - TRSRTransformation thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( - new Vector3f(0, 1f / 16, -3f / 16), - TRSRTransformation.quatFromYXZDegrees(new Vector3f(-90, 0, 0)), - new Vector3f(0.55f, 0.55f, 0.55f), - null)); - TRSRTransformation firstperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( - new Vector3f(0, 4f / 16, 2f / 16), - TRSRTransformation.quatFromYXZDegrees(new Vector3f(0, -135, 25)), - new Vector3f(1.7f, 1.7f, 1.7f), - null)); - return new SimpleModelState(ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson, TransformType.FIRST_PERSON, firstperson)); - } - - @Override - public boolean isGui3d() { - return false; - } -} \ No newline at end of file +///******************************************************************************* +// * Copyright (c) 2011-2014 SirSengir. +// * All rights reserved. This program and the accompanying materials +// * are made available under the terms of the GNU Lesser Public License v3 +// * which accompanies this distribution, and is available at +// * http://www.gnu.org/licenses/lgpl-3.0.txt +// * +// * Various Contributors including, but not limited to: +// * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges +// ******************************************************************************/ +//package forestry.core.models; +// +//import com.google.common.base.Charsets; +//import com.google.common.collect.ImmutableMap; +//import com.google.common.collect.Maps; +// +//import javax.vecmath.Vector3f; +//import java.io.FileNotFoundException; +//import java.io.IOException; +//import java.io.InputStreamReader; +//import java.io.Reader; +//import java.io.StringReader; +//import java.util.IdentityHashMap; +//import java.util.Map; +// +//import net.minecraft.client.Minecraft; +//import net.minecraft.client.renderer.block.model.BakedQuad; +//import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +//import net.minecraft.client.renderer.block.model.ModelBlock; +//import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +//import net.minecraft.client.resources.IResource; +//import net.minecraft.client.resources.model.IBakedModel; +//import net.minecraft.client.renderer.block.model.ModelBakery; +//import net.minecraft.client.renderer.block.model.ModelResourceLocation; +//import net.minecraft.item.Item; +//import net.minecraft.item.ItemStack; +//import net.minecraft.util.ResourceLocation; +// +//import net.minecraftforge.client.ItemModelMesherForge; +//import net.minecraftforge.client.event.ModelBakeEvent; +//import net.minecraftforge.client.model.IFlexibleBakedModel; +//import net.minecraftforge.client.model.IModel; +//import net.minecraftforge.client.model.IModelState; +//import net.minecraftforge.client.model.IPerspectiveAwareModel; +//import net.minecraftforge.client.model.ModelLoaderRegistry; +//import net.minecraftforge.client.model.MultiModel; +//import net.minecraftforge.client.model.SimpleModelState; +//import net.minecraftforge.client.model.TRSRTransformation; +//import net.minecraftforge.fml.common.ObfuscationReflectionHelper; +//import net.minecraftforge.fml.relauncher.Side; +//import net.minecraftforge.fml.relauncher.SideOnly; +// +//import forestry.core.items.ItemCrated; +//import forestry.core.utils.ItemStackUtil; +//import forestry.core.utils.Log; +//import forestry.storage.PluginStorage; +// +//import gnu.trove.map.hash.TIntObjectHashMap; +// +//@SideOnly(Side.CLIENT) +//public class ModelCrate extends BlankItemModel { +// +// private final Map crates = Maps.newHashMap(); +// +// private static IModel crateModel; +// private static ModelBlock MODEL_GENERATED; +// private static ModelBlock MODEL_COMPASS; +// private static ModelBlock MODEL_CLOCK; +// +// /** +// * Init the model +// */ +// public static void initModel(ModelBakeEvent event){ +// try { +// crateModel = ModelLoaderRegistry.getModel(new ModelResourceLocation("forestry:crate-filled", "inventory")); +// MODEL_GENERATED = ObfuscationReflectionHelper.getPrivateValue(ModelBakery.class, event.modelLoader, 14); +// MODEL_COMPASS = ObfuscationReflectionHelper.getPrivateValue(ModelBakery.class, event.modelLoader, 15); +// MODEL_CLOCK = ObfuscationReflectionHelper.getPrivateValue(ModelBakery.class, event.modelLoader, 16); +// } catch (Exception e) { +// Log.error("Failed to init the crate model.", e); +// } +// } +// +// /** +// * Bake the crate content models +// */ +// private ImmutableMap bakeContentModels(ItemCrated crateItem) { +// ImmutableMap.Builder pb = ImmutableMap.builder(); +// +// IFlexibleBakedModel containedModel = getModel(crateItem.getContained()); +// +// IdentityHashMap> modelResourceLocations = ObfuscationReflectionHelper.getPrivateValue(ItemModelMesherForge.class, (ItemModelMesherForge) Minecraft.getMinecraft().getRenderItem().getItemModelMesher(), 0); +// +// ModelResourceLocation modelResource = modelResourceLocations.get(crateItem.getContained().getItem()).get(crateItem.getContained().getItemDamage()); +// ResourceLocation location = getItemLocation(modelResource); +// +// if (hasItemModel(location)) { +// pb.put(String.valueOf(0), new TRSRBakedModel(containedModel, -0.0625F, 0, 0.0625F, 0.5F)); +// pb.put(String.valueOf(1), new TRSRBakedModel(containedModel, -0.0625F, 0, -0.0625F, 0.5F)); +// } else { +// pb.put(String.valueOf(0), new TRSRBakedModel(containedModel, -0.0625F, 0, 0, 0.5F)); +// } +// return pb.build(); +// } +// +// /** +// * @return The item model {@link ResourceLocation} from a {@link ModelResourceLocation} +// */ +// private ResourceLocation getItemLocation(ModelResourceLocation modelResource) { +// ResourceLocation resourcelocation = new ResourceLocation(modelResource.toString().replaceAll("#.*", "")); +// return new ResourceLocation(resourcelocation.getResourceDomain(), "item/" + resourcelocation.getResourcePath()); +// } +// +// /** +// * @return Return true, when the model a item model is +// */ +// private boolean hasItemModel(ResourceLocation location) { +// try { +// ModelBlock modelBlock = loadModel(location); +// if (modelBlock == null) { +// return false; +// } else { +// ModelBlock rootModelBlock = modelBlock.getRootModel(); +// return rootModelBlock == MODEL_GENERATED || rootModelBlock == MODEL_COMPASS || rootModelBlock == MODEL_CLOCK; +// } +// } catch (IOException e) { +// return false; +// } +// } +// +// private ModelBlock loadModel(ResourceLocation location) throws IOException { +// String s = location.getResourcePath(); +// +// if ("builtin/generated".equals(s)) { +// return MODEL_GENERATED; +// } else if ("builtin/compass".equals(s)) { +// return MODEL_COMPASS; +// } else if ("builtin/clock".equals(s)) { +// return MODEL_CLOCK; +// } else { +// Reader reader; +// +// if (s.startsWith("builtin/")) { +// String s1 = s.substring("builtin/".length()); +// if (s1.equals("missing")) { +// reader = new StringReader("{ \"textures\": { \"particle\": \"missingno\", \"missingno\": \"missingno\"}, \"elements\": [ { \"from\": [ 0, 0, 0 ], \"to\": [ 16, 16, 16 ], \"faces\": { \"down\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"down\", \"texture\": \"#missingno\" }, \"up\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"up\", \"texture\": \"#missingno\" }, \"north\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"north\", \"texture\": \"#missingno\" }, \"south\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"south\", \"texture\": \"#missingno\" }, \"west\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"west\", \"texture\": \"#missingno\" }, \"east\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"east\", \"texture\": \"#missingno\" } }}]}"); +// } else { +// throw new FileNotFoundException(location.toString()); +// } +// } else { +// IResource iresource = Minecraft.getMinecraft().getResourceManager().getResource(this.getModelLocation(location)); +// reader = new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8); +// } +// +// ModelBlock model; +// +// try { +// ModelBlock modelblock = ModelBlock.deserialize(reader); +// modelblock.name = location.toString(); +// model = modelblock; +// } finally { +// try { +// reader.close(); +// } catch (IOException e) { +// Log.error("Failed to close crate model reader.", e); +// } +// } +// +// if (model != null && model.getParentLocation() != null) { +// if (model.getParentLocation().getResourcePath().equals("builtin/generated")) { +// model.parent = MODEL_GENERATED; +// } else { +// try { +// model.parent = loadModel(model.getParentLocation()); +// } catch (IOException e) { +// Log.error("Failed to load model.", e); +// } +// } +// } +// +// return model; +// } +// } +// +// private ResourceLocation getModelLocation(ResourceLocation resourceLocation) { +// return new ResourceLocation(resourceLocation.getResourceDomain(), "models/" + resourceLocation.getResourcePath() + ".json"); +// } +// +// /** +// * @return The baked model from the filled crate +// */ +// private IFlexibleBakedModel getModel(ItemStack stack) { +// IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(stack); +// if (model == null) { +// return null; +// } else if (model instanceof IFlexibleBakedModel) { +// return (IFlexibleBakedModel) model; +// } else { +// return new IFlexibleBakedModel.Wrapper(model, DefaultVertexFormats.ITEM); +// } +// } +// +// /** +// * Bake the crated model +// */ +// @Override +// public IBakedModel handleItemState(ItemStack stack) { +// ItemCrated crated = (ItemCrated) stack.getItem(); +// String crateUID = ItemStackUtil.getItemNameFromRegistry(crated).getResourcePath(); +// if (crates.get(crateUID) == null) { +// IFlexibleBakedModel baseBaked = getModel(new ItemStack(PluginStorage.items.crate, 1, 1)); +// //Set the crate color index to 100 +// for (BakedQuad quad : baseBaked.getGeneralQuads()) { +// ObfuscationReflectionHelper.setPrivateValue(BakedQuad.class, quad, 100, 1); +// } +// crates.put(crateUID, new MultiModel.Baked(null, true, new IPerspectiveAwareModel.MapWrapper(baseBaked, getTransformations()), bakeContentModels(crated))); +// } +// return crates.get(crateUID); +// } +// +// public static IModelState getTransformations() { +// TRSRTransformation thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( +// new Vector3f(0, 1f / 16, -3f / 16), +// TRSRTransformation.quatFromYXZDegrees(new Vector3f(-90, 0, 0)), +// new Vector3f(0.55f, 0.55f, 0.55f), +// null)); +// TRSRTransformation firstperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( +// new Vector3f(0, 4f / 16, 2f / 16), +// TRSRTransformation.quatFromYXZDegrees(new Vector3f(0, -135, 25)), +// new Vector3f(1.7f, 1.7f, 1.7f), +// null)); +// return new SimpleModelState(ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson, TransformType.FIRST_PERSON, firstperson)); +// } +// +// @Override +// public boolean isGui3d() { +// return false; +// } +//} diff --git a/src/main/java/forestry/core/models/ModelIndex.java b/src/main/java/forestry/core/models/ModelIndex.java index 3a25ae29c..6271c9318 100644 --- a/src/main/java/forestry/core/models/ModelIndex.java +++ b/src/main/java/forestry/core/models/ModelIndex.java @@ -10,8 +10,9 @@ ******************************************************************************/ package forestry.core.models; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/forestry/core/models/ModelManager.java b/src/main/java/forestry/core/models/ModelManager.java index ce3eed9fe..05dc5b3d6 100644 --- a/src/main/java/forestry/core/models/ModelManager.java +++ b/src/main/java/forestry/core/models/ModelManager.java @@ -15,12 +15,12 @@ import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; -import net.minecraft.util.IRegistry; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.IRegistry; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.model.ModelLoader; @@ -110,7 +110,7 @@ public class ModelManager implements IModelManager { } public static void registerCustomModels(ModelBakeEvent event) { - IRegistry registry = event.modelRegistry; + IRegistry registry = event.getModelRegistry(); for (final BlockModelIndex index : customBlockModels) { registry.putObject(index.blockModelLocation, index.model); registry.putObject(index.itemModelLocation, index.model); diff --git a/src/main/java/forestry/core/models/baker/ModelBaker.java b/src/main/java/forestry/core/models/baker/ModelBaker.java index 051059ffb..cd8aafd63 100644 --- a/src/main/java/forestry/core/models/baker/ModelBaker.java +++ b/src/main/java/forestry/core/models/baker/ModelBaker.java @@ -17,18 +17,19 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.BlockFaceUV; import net.minecraft.client.renderer.block.model.BlockPartFace; import net.minecraft.client.renderer.block.model.FaceBakery; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelRotation; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; -import net.minecraftforge.client.model.IColoredBakedQuad; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -48,14 +49,7 @@ public class ModelBaker implements IModelBaker { private final List faces = new ArrayList<>(); private final List bakedModels = new ArrayList<>(); - protected double renderMinX; - protected double renderMaxX; - - protected double renderMinY; - protected double renderMaxY; - - protected double renderMinZ; - protected double renderMaxZ; + protected AxisAlignedBB renderBounds; protected ModelBakerModel currentModel = new ModelBakerModel(); @@ -69,22 +63,13 @@ public class ModelBaker implements IModelBaker { return; } - renderMinX = block.getBlockBoundsMinX(); - renderMinY = block.getBlockBoundsMinY(); - renderMinZ = block.getBlockBoundsMinZ(); - renderMaxX = block.getBlockBoundsMaxX(); - renderMaxY = block.getBlockBoundsMaxY(); - renderMaxZ = block.getBlockBoundsMaxZ(); + //TODO: Fixme + renderBounds = Block.FULL_BLOCK_AABB; } @Override - public void setRenderBounds(double d, double e, double f, double g, double h, double i) { - renderMinX = d; - renderMinY = e; - renderMinZ = f; - renderMaxX = g; - renderMaxY = h; - renderMaxZ = i; + public void setRenderBounds(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { + renderBounds = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ); } protected int colorIndex = -1; @@ -101,44 +86,13 @@ public class ModelBaker implements IModelBaker { setColorIndex(colorIndex); World world = Proxies.common.getRenderWorld(); - BlockPos posDOWN = null; - BlockPos posUP = null; - BlockPos posEAST = null; - BlockPos posWEST = null; - BlockPos posNORTH = null; - BlockPos posSOUTH = null; - if(pos != null){ - posDOWN = new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ()); - posUP = new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()); - posEAST = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ()); - posWEST = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()); - posNORTH = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1); - posSOUTH = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1); + IBlockState blockState = world.getBlockState(pos); + for (EnumFacing facing : EnumFacing.VALUES) { + if (pos == null || block.shouldSideBeRendered(blockState, world, pos, facing)) { + addFace(facing, textures[facing.ordinal()]); + } } - if (pos == null || block.shouldSideBeRendered(world, posDOWN, EnumFacing.DOWN)) { - addFaceYNeg(textures[EnumFacing.DOWN.ordinal()]); - } - - if (pos == null || block.shouldSideBeRendered(world, posUP, EnumFacing.UP)) { - addFaceYPos(textures[EnumFacing.UP.ordinal()]); - } - - if (pos == null || block.shouldSideBeRendered(world, posEAST, EnumFacing.EAST)) { - addFaceXNeg(textures[EnumFacing.EAST.ordinal()]); - } - - if (pos == null || block.shouldSideBeRendered(world, posWEST, EnumFacing.WEST)) { - addFaceXPos(textures[EnumFacing.WEST.ordinal()]); - } - - if (pos == null || block.shouldSideBeRendered(world, posNORTH, EnumFacing.NORTH)) { - addFaceZNeg(textures[EnumFacing.NORTH.ordinal()]); - } - - if (pos == null || block.shouldSideBeRendered(world, posSOUTH, EnumFacing.SOUTH)) { - addFaceZPos(textures[EnumFacing.SOUTH.ordinal()]); - } setRenderBounds(0, 0, 0, 1, 1, 1); } @@ -152,7 +106,7 @@ public class ModelBaker implements IModelBaker { this.bakedModels.add(model); } - protected float[] getFaceUvs(final EnumFacing face, final Vector3f to_16, final Vector3f from_16) { + protected static float[] getFaceUvs(final EnumFacing face, final Vector3f to_16, final Vector3f from_16) { float from_a = 0; float from_b = 0; float to_a = 0; @@ -219,65 +173,39 @@ public class ModelBaker implements IModelBaker { } @Override - public void addFaceXNeg(@Nonnull TextureAtlasSprite sprite) { - boolean isEdge = renderMinX < 0.0001; - Vector3f to = new Vector3f((float) renderMinX * 16.0f, (float) renderMinY * 16.0f, (float) renderMinZ * 16.0f); - Vector3f from = new Vector3f((float) renderMinX * 16.0f, (float) renderMaxY * 16.0f, (float) renderMaxZ * 16.0f); - - addFace(EnumFacing.WEST, isEdge, to, from, defUVs, sprite); - } - - @Override - public void addFaceYNeg(@Nonnull TextureAtlasSprite sprite) { - boolean isEdge = renderMinY < 0.0001; - Vector3f to = new Vector3f((float) renderMinX * 16.0f, (float) renderMinY * 16.0f, (float) renderMinZ * 16.0f); - Vector3f from = new Vector3f((float) renderMaxX * 16.0f, (float) renderMinY * 16.0f, (float) renderMaxZ * 16.0f); - - addFace(EnumFacing.DOWN, isEdge, to, from, defUVs, sprite); - } - - @Override - public void addFaceZNeg(@Nonnull TextureAtlasSprite sprite) { - boolean isEdge = renderMinZ < 0.0001; - Vector3f to = new Vector3f((float) renderMinX * 16.0f, (float) renderMinY * 16.0f, (float) renderMinZ * 16.0f); - Vector3f from = new Vector3f((float) renderMaxX * 16.0f, (float) renderMaxY * 16.0f, (float) renderMinZ * 16.0f); - - addFace(EnumFacing.NORTH, isEdge, to, from, defUVs, sprite); - } - - @Override - public void addFaceYPos(@Nonnull TextureAtlasSprite sprite) { - boolean isEdge = renderMaxY > 0.9999; - Vector3f to = new Vector3f((float) renderMinX * 16.0f, (float) renderMaxY * 16.0f, (float) renderMinZ * 16.0f); - Vector3f from = new Vector3f((float) renderMaxX * 16.0f, (float) renderMaxY * 16.0f, (float) renderMaxZ * 16.0f); - - addFace(EnumFacing.UP, isEdge, to, from, defUVs, sprite); - } - - @Override - public void addFaceZPos(@Nonnull TextureAtlasSprite sprite) { - boolean isEdge = renderMaxZ > 0.9999; - Vector3f to = new Vector3f((float) renderMinX * 16.0f, (float) renderMinY * 16.0f, (float) renderMaxZ * 16.0f); - Vector3f from = new Vector3f((float) renderMaxX * 16.0f, (float) renderMaxY * 16.0f, (float) renderMaxZ * 16.0f); - - addFace(EnumFacing.SOUTH, isEdge, to, from, defUVs, sprite); - } - - @Override - public void addFaceXPos(@Nonnull TextureAtlasSprite sprite) { - - boolean isEdge = renderMaxX > 0.9999; - Vector3f to = new Vector3f((float) renderMaxX * 16.0f, (float) renderMinY * 16.0f, (float) renderMinZ * 16.0f); - Vector3f from = new Vector3f((float) renderMaxX * 16.0f, (float) renderMaxY * 16.0f, (float) renderMaxZ * 16.0f); - - addFace(EnumFacing.EAST, isEdge, to, from, defUVs, sprite); - } - - protected void addFace(@Nonnull EnumFacing face, boolean isEdge, Vector3f to, Vector3f from, float[] defUVs2, TextureAtlasSprite texture) { - if(texture == null) { + public void addFace(@Nonnull EnumFacing facing, @Nonnull TextureAtlasSprite sprite) { + if (sprite == null) { return; } - faces.add(new ModelBakerFace(face, isEdge, colorIndex, to, from, defUVs2, texture)); + + boolean isEdge; + switch (facing) { + case WEST: + isEdge = renderBounds.minX < 0.0001; + break; + case DOWN: + isEdge = renderBounds.minY < 0.0001; + break; + case NORTH: + isEdge = renderBounds.minZ < 0.0001; + break; + case UP: + isEdge = renderBounds.maxY > 0.9999; + break; + case SOUTH: + isEdge = renderBounds.maxZ > 0.9999; + break; + case EAST: + isEdge = renderBounds.maxX > 0.9999; + break; + default: + return; + } + + Vector3f to = new Vector3f((float) renderBounds.minX * 16.0f, (float) renderBounds.minY * 16.0f, (float) renderBounds.minZ * 16.0f); + Vector3f from = new Vector3f((float) renderBounds.maxX * 16.0f, (float) renderBounds.maxY * 16.0f, (float) renderBounds.maxZ * 16.0f); + + faces.add(new ModelBakerFace(facing, isEdge, colorIndex, to, from, defUVs, sprite)); } @Override @@ -290,10 +218,7 @@ public class ModelBaker implements IModelBaker { //Add baked models to the current model. for(IBakedModel bakedModel : bakedModels){ - for(EnumFacing gce : EnumFacing.VALUES){ - this.currentModel.getFaceQuads(gce).addAll(bakedModel.getFaceQuads(gce)); - } - this.currentModel.getGeneralQuads().addAll(bakedModel.getGeneralQuads()); + this.currentModel.addModelQuads(bakedModel); } for (ModelBakerFace face : faces) { @@ -304,13 +229,13 @@ public class ModelBaker implements IModelBaker { final BlockPartFace bpf = new BlockPartFace(myFace, face.colorIndex, "", uv); BakedQuad bf = faceBakery.makeBakedQuad(face.to, face.from, bpf, face.spite, myFace, mr, null, true, true); - bf = new IColoredBakedQuad.ColoredBakedQuad(bf.getVertexData(), face.colorIndex, bf.getFace()); +// bf = new IColoredBakedQuad.ColoredBakedQuad(bf.getVertexData(), face.colorIndex, bf.getFace()); - if (face.isEdge) { - this.currentModel.getFaceQuads(myFace).add(bf); - } else { - this.currentModel.getGeneralQuads().add(bf); - } +// if (face.isEdge) { +// this.currentModel.getFaceQuads(myFace).add(bf); +// } else { +// this.currentModel.getGeneralQuads().add(bf); +// } } return currentModel; diff --git a/src/main/java/forestry/core/models/baker/ModelBakerModel.java b/src/main/java/forestry/core/models/baker/ModelBakerModel.java index 52ae33a1a..cd8b6e909 100644 --- a/src/main/java/forestry/core/models/baker/ModelBakerModel.java +++ b/src/main/java/forestry/core/models/baker/ModelBakerModel.java @@ -11,52 +11,47 @@ package forestry.core.models.baker; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemTransformVec3f; +import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.util.vector.Vector3f; - import forestry.api.core.IModelBakerModel; @SideOnly(Side.CLIENT) public class ModelBakerModel implements IModelBakerModel { - private List[] faces = new List[6]; - private List general; + private final List models; private boolean isGui3d; private boolean isAmbientOcclusion; - private VertexFormat formate; + private VertexFormat format; private TextureAtlasSprite particleSprite; private float[] rotation = getDefaultRotation(); private float[] translation = getDefaultTranslation(); private float[] scale = getDefaultScale(); public ModelBakerModel() { - general = new ArrayList<>(); - for (EnumFacing f : EnumFacing.VALUES) { - faces[f.ordinal()] = new ArrayList<>(); - } - formate = DefaultVertexFormats.BLOCK; + models = new ArrayList<>(); + format = DefaultVertexFormats.BLOCK; isGui3d = true; isAmbientOcclusion = false; } - private ModelBakerModel(List general, List[] faces, boolean isGui3d, boolean isAmbientOcclusion, VertexFormat formate, float[] rotation, float[] translation, float[] scale, TextureAtlasSprite particleSprite) { - this.general = general; - this.faces = faces; + private ModelBakerModel(List models, boolean isGui3d, boolean isAmbientOcclusion, VertexFormat format, float[] rotation, float[] translation, float[] scale, TextureAtlasSprite particleSprite) { + this.models = models; this.isGui3d = isGui3d; this.isAmbientOcclusion = isAmbientOcclusion; - this.formate = formate; + this.format = format; this.rotation = rotation; this.translation = translation; this.scale = scale; @@ -93,16 +88,6 @@ public class ModelBakerModel implements IModelBakerModel { return particleSprite; } - @Override - public VertexFormat getFormat() { - return formate; - } - - @Override - public void setFormat(VertexFormat formate) { - this.formate = formate; - } - @Override public boolean isBuiltInRenderer() { return false; @@ -110,24 +95,12 @@ public class ModelBakerModel implements IModelBakerModel { @Override public ItemCameraTransforms getItemCameraTransforms() { - return getTransform(); + return ItemCameraTransforms.DEFAULT; } - public ItemCameraTransforms getTransform() { - Vector3f rotation = new Vector3f(getRotation()[0], getRotation()[1], getRotation()[2]); - Vector3f translation = new Vector3f(getTranslation()[0], getTranslation()[1], getTranslation()[2]); - translation.scale(0.0625F); - MathHelper.clamp_double(translation.x, -1.5D, 1.5D); - MathHelper.clamp_double(translation.y, -1.5D, 1.5D); - MathHelper.clamp_double(translation.z, -1.5D, 1.5D); - Vector3f scale = new Vector3f(getScale()[0], getScale()[1], getScale()[2]); - MathHelper.clamp_double(scale.x, -1.5D, 1.5D); - MathHelper.clamp_double(scale.y, -1.5D, 1.5D); - MathHelper.clamp_double(scale.z, -1.5D, 1.5D); - - new ItemTransformVec3f(rotation, translation, scale); - ItemTransformVec3f transformV = new ItemTransformVec3f(rotation, translation, scale); - return new ItemCameraTransforms(transformV, ItemCameraTransforms.DEFAULT.firstPerson, ItemCameraTransforms.DEFAULT.head, ItemCameraTransforms.DEFAULT.gui, ItemCameraTransforms.DEFAULT.ground, ItemCameraTransforms.DEFAULT.fixed); + @Override + public ItemOverrideList getOverrides() { + return ItemOverrideList.NONE; } public static float[] getDefaultRotation() { @@ -172,17 +145,26 @@ public class ModelBakerModel implements IModelBakerModel { return scale; } - @Override - public List getGeneralQuads() { - return general; + public void addModelQuads(IBakedModel model) { + this.models.add(model); } @Override - public List getFaceQuads(EnumFacing face) { - return faces[face.ordinal()]; + public List getQuads(IBlockState state, EnumFacing side, long rand) { + List quads = new ArrayList<>(); + if (side == null) { + for (IBakedModel model : this.models) { + quads.addAll(model.getQuads(state, null, rand)); + } + } else { + for (IBakedModel model : this.models) { + quads.addAll(model.getQuads(state, side, rand)); + } + } + return quads; } public ModelBakerModel copy() { - return new ModelBakerModel(general, faces, isGui3d, isAmbientOcclusion, formate, rotation, translation, scale, particleSprite); + return new ModelBakerModel(models, isGui3d, isAmbientOcclusion, format, rotation, translation, scale, particleSprite); } } diff --git a/src/main/java/forestry/core/multiblock/FakeMultiblockController.java b/src/main/java/forestry/core/multiblock/FakeMultiblockController.java index 7191739aa..7d229f985 100644 --- a/src/main/java/forestry/core/multiblock/FakeMultiblockController.java +++ b/src/main/java/forestry/core/multiblock/FakeMultiblockController.java @@ -17,7 +17,7 @@ import java.util.Collections; import java.util.Set; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.core.EnumHumidity; diff --git a/src/main/java/forestry/core/multiblock/IMultiblockControllerInternal.java b/src/main/java/forestry/core/multiblock/IMultiblockControllerInternal.java index 5424d8977..df9e55eaf 100644 --- a/src/main/java/forestry/core/multiblock/IMultiblockControllerInternal.java +++ b/src/main/java/forestry/core/multiblock/IMultiblockControllerInternal.java @@ -14,7 +14,7 @@ import javax.annotation.Nonnull; import java.util.Set; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.core.IErrorLogicSource; diff --git a/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java b/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java index 42580c4fd..a7c5235c1 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java +++ b/src/main/java/forestry/core/multiblock/MultiblockControllerBase.java @@ -13,7 +13,7 @@ import forestry.core.utils.Translator; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; @@ -372,7 +372,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI @Override public void _onAssimilated(IMultiblockControllerInternal otherController) { if (referenceCoord != null) { - if (worldObj.getChunkProvider().chunkExists(referenceCoord.getX() >> 4, referenceCoord.getZ() >> 4)) { + if (worldObj.getChunkProvider().getLoadedChunk(referenceCoord.getX() >> 4, referenceCoord.getZ() >> 4) != null) { TileEntity te = this.worldObj.getTileEntity(referenceCoord); if (te instanceof IMultiblockComponent) { IMultiblockComponent part = (IMultiblockComponent) te; @@ -694,7 +694,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI for (IMultiblockComponent part : connectedParts) { // This happens during chunk unload. BlockPos partCoord = part.getCoordinates(); - if (!chunkProvider.chunkExists(partCoord.getX() >> 4, partCoord.getZ() >> 4) || isInvalid(part)) { + if (chunkProvider.getLoadedChunk(partCoord.getX() >> 4, partCoord.getZ() >> 4) == null || isInvalid(part)) { deadParts.add(part); onDetachBlock(part); continue; @@ -798,7 +798,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI IChunkProvider chunkProvider = worldObj.getChunkProvider(); for (IMultiblockComponent part : connectedParts) { BlockPos partCoord = part.getCoordinates(); - if (chunkProvider.chunkExists(partCoord.getX() >> 4, partCoord.getZ() >> 4)) { + if (chunkProvider.getLoadedChunk(partCoord.getX() >> 4, partCoord.getZ() >> 4) != null) { onDetachBlock(part); } } @@ -823,7 +823,7 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI for (IMultiblockComponent part : connectedParts) { BlockPos partCoord = part.getCoordinates(); - if (isInvalid(part) || !chunkProvider.chunkExists(partCoord.getX() >> 4, partCoord.getZ() >> 4)) { + if (isInvalid(part) || chunkProvider.getLoadedChunk(partCoord.getX() >> 4, partCoord.getZ() >> 4) == null) { // Chunk is unloading, skip this coord to prevent chunk thrashing continue; } @@ -839,47 +839,6 @@ public abstract class MultiblockControllerBase implements IMultiblockControllerI logic.becomeMultiblockSaveDelegate(); } } - - /** - * Marks the reference coord dirty & updateable. - * - * On the server, this will mark the for a data-update, so that - * nearby clients will receive an updated description packet from the server - * after a short time. The block's chunk will also be marked dirty and the - * block's chunk will be saved to disk the next time chunks are saved. - * - * On the client, this will mark the block for a rendering update. - */ - protected void markReferenceCoordForUpdate() { - BlockPos rc = getReferenceCoord(); - if (worldObj != null && rc != null) { - worldObj.markBlockForUpdate(rc); - } - } - - /** - * Marks the reference coord dirty. - * - * On the server, this marks the reference coord's chunk as dirty; the block (and chunk) - * will be saved to disk the next time chunks are saved. This does NOT mark it dirty for - * a description-packet update. - * - * On the client, does nothing. - * @see MultiblockControllerBase#markReferenceCoordForUpdate() - */ - protected void markReferenceCoordDirty() { - if (worldObj == null || worldObj.isRemote) { - return; - } - - BlockPos referenceCoord = getReferenceCoord(); - if (referenceCoord == null) { - return; - } - - TileEntity saveTe = worldObj.getTileEntity(referenceCoord); - worldObj.markChunkDirty(referenceCoord, saveTe); - } private static boolean isInvalid(IMultiblockComponent part) { return part instanceof TileEntity && ((TileEntity) part).isInvalid(); diff --git a/src/main/java/forestry/core/multiblock/MultiblockControllerForestry.java b/src/main/java/forestry/core/multiblock/MultiblockControllerForestry.java index 3f594fed4..ddacb3110 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockControllerForestry.java +++ b/src/main/java/forestry/core/multiblock/MultiblockControllerForestry.java @@ -20,7 +20,7 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; @@ -156,7 +156,7 @@ public abstract class MultiblockControllerForestry extends MultiblockControllerB } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return getInternalInventory().getDisplayName(); } diff --git a/src/main/java/forestry/core/multiblock/MultiblockLogic.java b/src/main/java/forestry/core/multiblock/MultiblockLogic.java index c2688c606..0cc25ab9a 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockLogic.java +++ b/src/main/java/forestry/core/multiblock/MultiblockLogic.java @@ -11,7 +11,7 @@ package forestry.core.multiblock; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.multiblock.IMultiblockComponent; diff --git a/src/main/java/forestry/core/multiblock/MultiblockTileEntityForestry.java b/src/main/java/forestry/core/multiblock/MultiblockTileEntityForestry.java index 3b4b9b0ba..98f11aec9 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockTileEntityForestry.java +++ b/src/main/java/forestry/core/multiblock/MultiblockTileEntityForestry.java @@ -18,7 +18,7 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; @@ -129,7 +129,7 @@ public abstract class MultiblockTileEntityForestry e } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return getInternalInventory().getDisplayName(); } diff --git a/src/main/java/forestry/core/multiblock/MultiblockUtil.java b/src/main/java/forestry/core/multiblock/MultiblockUtil.java index e6b99a9f9..e0e84cd40 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockUtil.java +++ b/src/main/java/forestry/core/multiblock/MultiblockUtil.java @@ -14,7 +14,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; diff --git a/src/main/java/forestry/core/multiblock/MultiblockWorldRegistry.java b/src/main/java/forestry/core/multiblock/MultiblockWorldRegistry.java index 246bac833..657a67091 100644 --- a/src/main/java/forestry/core/multiblock/MultiblockWorldRegistry.java +++ b/src/main/java/forestry/core/multiblock/MultiblockWorldRegistry.java @@ -9,7 +9,7 @@ import java.util.List; import java.util.Set; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; diff --git a/src/main/java/forestry/core/multiblock/RectangularMultiblockControllerBase.java b/src/main/java/forestry/core/multiblock/RectangularMultiblockControllerBase.java index 49c46032c..623ae6e1d 100644 --- a/src/main/java/forestry/core/multiblock/RectangularMultiblockControllerBase.java +++ b/src/main/java/forestry/core/multiblock/RectangularMultiblockControllerBase.java @@ -2,7 +2,7 @@ package forestry.core.multiblock; import forestry.core.utils.Translator; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.multiblock.IMultiblockComponent; diff --git a/src/main/java/forestry/core/network/ILocatedPacket.java b/src/main/java/forestry/core/network/ILocatedPacket.java index 14f409252..1a52f0f4c 100755 --- a/src/main/java/forestry/core/network/ILocatedPacket.java +++ b/src/main/java/forestry/core/network/ILocatedPacket.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.core.network; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public interface ILocatedPacket { BlockPos getPos(); diff --git a/src/main/java/forestry/core/network/packets/PacketCoordinates.java b/src/main/java/forestry/core/network/packets/PacketCoordinates.java index 105069e93..ad3c07092 100644 --- a/src/main/java/forestry/core/network/packets/PacketCoordinates.java +++ b/src/main/java/forestry/core/network/packets/PacketCoordinates.java @@ -13,7 +13,7 @@ package forestry.core.network.packets; import java.io.IOException; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.core.network.DataInputStreamForestry; diff --git a/src/main/java/forestry/core/network/packets/PacketEntityUpdate.java b/src/main/java/forestry/core/network/packets/PacketEntityUpdate.java index 410730b5e..1e0c76c85 100644 --- a/src/main/java/forestry/core/network/packets/PacketEntityUpdate.java +++ b/src/main/java/forestry/core/network/packets/PacketEntityUpdate.java @@ -13,7 +13,7 @@ package forestry.core.network.packets; import java.io.IOException; import net.minecraft.entity.Entity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.core.network.DataInputStreamForestry; diff --git a/src/main/java/forestry/core/network/packets/PacketFXSignal.java b/src/main/java/forestry/core/network/packets/PacketFXSignal.java index 691eedd5d..628ae59c6 100644 --- a/src/main/java/forestry/core/network/packets/PacketFXSignal.java +++ b/src/main/java/forestry/core/network/packets/PacketFXSignal.java @@ -14,7 +14,11 @@ import java.io.IOException; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.init.Blocks; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import forestry.core.network.DataInputStreamForestry; import forestry.core.network.DataOutputStreamForestry; @@ -30,14 +34,19 @@ public class PacketFXSignal extends PacketCoordinates implements IForestryPacket } public enum SoundFXType { - NONE(""), BLOCK_DESTROY(""), BLOCK_PLACE(""), LEAF("step.grass"), LOG("dig.wood"), DIRT("dig.gravel"); + NONE(null), + BLOCK_DESTROY(null), + BLOCK_PLACE(null), + LEAF(Blocks.LEAVES.getSoundType().getStepSound()), + LOG(Blocks.LOG.getSoundType().getBreakSound()), + DIRT(Blocks.DIRT.getSoundType().getBreakSound()); - public final String soundFile; + public final SoundEvent soundEvent; public final float volume; public final float pitch; - SoundFXType(String soundFile) { - this.soundFile = soundFile; + SoundFXType(SoundEvent soundEvent) { + this.soundEvent = soundEvent; this.volume = 1.0f; this.pitch = 1.0f; } @@ -86,21 +95,21 @@ public class PacketFXSignal extends PacketCoordinates implements IForestryPacket @Override public void onPacketData(DataInputStreamForestry data, EntityPlayer player) throws IOException { + World renderWorld = Proxies.common.getRenderWorld(); if (visualFX != VisualFXType.NONE) { - Proxies.common.addBlockDestroyEffects(Proxies.common.getRenderWorld(), getPos(), state); + Proxies.common.addBlockDestroyEffects(renderWorld, getPos(), state); } if (soundFX != SoundFXType.NONE) { if (soundFX == SoundFXType.BLOCK_DESTROY) { - Proxies.common.playBlockBreakSoundFX(Proxies.common.getRenderWorld(), getPos(), state); + Proxies.common.playBlockBreakSoundFX(renderWorld, getPos(), state); } else if (soundFX == SoundFXType.BLOCK_PLACE) { - Proxies.common.playBlockPlaceSoundFX(Proxies.common.getRenderWorld(), getPos(), state); + Proxies.common.playBlockPlaceSoundFX(renderWorld, getPos(), state); } else { - Proxies.common.playSoundFX(Proxies.common.getRenderWorld(), getPos(), soundFX.soundFile, soundFX.volume, soundFX.pitch); + Proxies.common.playSoundFX(renderWorld, getPos(), soundFX.soundEvent, SoundCategory.BLOCKS, soundFX.volume, soundFX.pitch); } } } - @Override public PacketIdClient getPacketId() { return PacketIdClient.FX_SIGNAL; diff --git a/src/main/java/forestry/core/proxy/ProxyCommon.java b/src/main/java/forestry/core/proxy/ProxyCommon.java index cf7e92526..ed1df3203 100755 --- a/src/main/java/forestry/core/proxy/ProxyCommon.java +++ b/src/main/java/forestry/core/proxy/ProxyCommon.java @@ -17,7 +17,10 @@ import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.server.management.UserListOpsEntry; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -54,7 +57,8 @@ public class ProxyCommon { public boolean isOp(EntityPlayer player) { MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); - return server.getConfigurationManager().canSendCommands(player.getGameProfile()); + UserListOpsEntry userlistopsentry = server.getPlayerList().getOppedPlayers().getEntry(player.getGameProfile()); + return userlistopsentry.getPermissionLevel() >= server.getOpPermissionLevel(); } public double getBlockReachDistance(EntityPlayer entityplayer) { @@ -65,11 +69,7 @@ public class ProxyCommon { return false; } - public void playSoundFX(World world, BlockPos pos, IBlockState state) { - Proxies.net.sendNetworkPacket(new PacketFXSignal(PacketFXSignal.SoundFXType.LEAF, pos, state), world); - } - - public void playSoundFX(World world, BlockPos pos, String sound, float volume, float pitch) { + public void playSoundFX(World world, BlockPos pos, SoundEvent sound, SoundCategory soundCategory, float volume, float pitch) { } public void addBlockDestroyEffects(World world, BlockPos pos, IBlockState state) { @@ -87,9 +87,7 @@ public class ProxyCommon { } public void sendFXSignal(PacketFXSignal.VisualFXType visualFX, PacketFXSignal.SoundFXType soundFX, World world, BlockPos pos, IBlockState state) { - if (!world.isRemote) { - Proxies.net.sendNetworkPacket(new PacketFXSignal(visualFX, soundFX, pos, state), world); - } + Proxies.net.sendNetworkPacket(new PacketFXSignal(visualFX, soundFX, pos, state), world); } public World getRenderWorld() { diff --git a/src/main/java/forestry/core/proxy/ProxyCommonClient.java b/src/main/java/forestry/core/proxy/ProxyCommonClient.java index f858cd4de..735800b0a 100644 --- a/src/main/java/forestry/core/proxy/ProxyCommonClient.java +++ b/src/main/java/forestry/core/proxy/ProxyCommonClient.java @@ -18,7 +18,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -27,6 +29,7 @@ import org.lwjgl.input.Keyboard; import forestry.core.TickHandlerCoreClient; import forestry.core.multiblock.MultiblockClientTickHandler; +import forestry.core.network.packets.PacketFXSignal; import forestry.core.worldgen.WorldGenerator; public class ProxyCommonClient extends ProxyCommon { @@ -73,42 +76,28 @@ public class ProxyCommonClient extends ProxyCommon { return itemstack.getItem().getItemStackDisplayName(itemstack); } - @Override - public void playSoundFX(World world, BlockPos pos, IBlockState state) { - Block block = state.getBlock(); - if (!world.isRemote) { - super.playSoundFX(world, pos, state); - } else { - playSoundFX(world, pos, block.stepSound.getStepSound(), block.stepSound.getVolume(), block.stepSound.getFrequency()); - } - } - @Override public void playBlockBreakSoundFX(World world, BlockPos pos, IBlockState state) { Block block = state.getBlock(); - if (!world.isRemote) { - super.playSoundFX(world, pos, state); - } else { - playSoundFX(world, pos, block.stepSound.getBreakSound(), block.stepSound.getVolume() / 4, block.stepSound.getFrequency()); - } + playSoundFX(world, pos, block.getSoundType().getBreakSound(), SoundCategory.BLOCKS, block.getSoundType().getVolume() / 4, block.getSoundType().getPitch()); } @Override public void playBlockPlaceSoundFX(World world, BlockPos pos, IBlockState state) { Block block = state.getBlock(); - if (!world.isRemote) { - super.playSoundFX(world, pos, state); - } else { - playSoundFX(world, pos, block.stepSound.getStepSound(), block.stepSound.getVolume() / 4, block.stepSound.getFrequency()); - } + playSoundFX(world, pos, block.getSoundType().getStepSound(), SoundCategory.BLOCKS, block.getSoundType().getVolume() / 4, block.getSoundType().getPitch()); } @Override - public void playSoundFX(World world, BlockPos pos, String sound, float volume, float pitch) { + public void sendFXSignal(PacketFXSignal.VisualFXType visualFX, PacketFXSignal.SoundFXType soundFX, World world, BlockPos pos, IBlockState state) { + } + + @Override + public void playSoundFX(World world, BlockPos pos, SoundEvent sound, SoundCategory soundCategory, float volume, float pitch) { int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); - world.playSound(x + 0.5, y + 0.5, z + 0.5, sound, volume, (1.0f + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2f) * 0.7f, false); + world.playSound(x + 0.5, y + 0.5, z + 0.5, sound, soundCategory, volume, pitch, false); } @Override diff --git a/src/main/java/forestry/core/proxy/ProxyRender.java b/src/main/java/forestry/core/proxy/ProxyRender.java index 0b76d9b11..364a983d6 100644 --- a/src/main/java/forestry/core/proxy/ProxyRender.java +++ b/src/main/java/forestry/core/proxy/ProxyRender.java @@ -19,11 +19,11 @@ import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.resources.IResourceManager; import net.minecraft.entity.Entity; -import net.minecraft.util.BlockPos; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.client.model.animation.ITimeValue; +import net.minecraftforge.common.animation.ITimeValue; import net.minecraftforge.common.model.animation.IAnimationStateMachine; import forestry.core.fluids.Fluids; diff --git a/src/main/java/forestry/core/proxy/ProxyRenderClient.java b/src/main/java/forestry/core/proxy/ProxyRenderClient.java index 0fe86a849..2cf35259c 100644 --- a/src/main/java/forestry/core/proxy/ProxyRenderClient.java +++ b/src/main/java/forestry/core/proxy/ProxyRenderClient.java @@ -20,23 +20,25 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EffectRenderer; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.ItemMeshDefinition; +import net.minecraft.client.renderer.block.model.ModelBakery; + + import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.animation.Animation; -import net.minecraftforge.client.model.animation.ITimeValue; +import net.minecraftforge.common.animation.ITimeValue; import net.minecraftforge.common.model.animation.IAnimationStateMachine; import forestry.apiculture.entities.EntityFXBee; @@ -51,7 +53,6 @@ import forestry.core.entities.EntityFXSnow; import forestry.core.fluids.Fluids; import forestry.core.items.ItemCrated; import forestry.core.models.BlockModelIndex; -import forestry.core.models.ModelCrate; import forestry.core.models.ModelIndex; import forestry.core.models.ModelManager; import forestry.core.render.RenderAnalyzer; @@ -142,7 +143,8 @@ public class ProxyRenderClient extends ProxyRender { public void registerModelCrate(ItemCrated crate) { String cleanItemName = ItemStackUtil.getItemNameFromRegistry(crate).getResourcePath(); ModelResourceLocation modelLocation = new ModelResourceLocation("forestry:crate-filled", cleanItemName); - registerModel(new ModelIndex(modelLocation, new ModelCrate())); + // TODO: fix crate rendering +// registerModel(new ModelIndex(modelLocation, new ModelCrate())); } @Override diff --git a/src/main/java/forestry/core/recipes/jei/ForestryTooltipCallback.java b/src/main/java/forestry/core/recipes/jei/ForestryTooltipCallback.java index 71dbf329d..177d20fe0 100644 --- a/src/main/java/forestry/core/recipes/jei/ForestryTooltipCallback.java +++ b/src/main/java/forestry/core/recipes/jei/ForestryTooltipCallback.java @@ -6,7 +6,7 @@ import java.text.NumberFormat; import java.util.List; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import forestry.core.utils.Translator; @@ -38,13 +38,13 @@ public class ForestryTooltipCallback implements ITooltipCallback { public void addChanceTooltip(int index, float chance) { if (chance <= 0.0F) { - tooltips.get(index).add(EnumChatFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), Translator.translateToLocal("forestry.jei.chance.never"))); + tooltips.get(index).add(TextFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), Translator.translateToLocal("forestry.jei.chance.never"))); } else if (chance < 0.01F) { - tooltips.get(index).add(EnumChatFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), Translator.translateToLocal("forestry.jei.chance.lessThan1"))); + tooltips.get(index).add(TextFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), Translator.translateToLocal("forestry.jei.chance.lessThan1"))); } else if (chance != 1.0F) { NumberFormat percentFormat = NumberFormat.getPercentInstance(); percentFormat.setMaximumFractionDigits(2); - tooltips.get(index).add(EnumChatFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), String.valueOf(percentFormat.format(chance)))); + tooltips.get(index).add(TextFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), String.valueOf(percentFormat.format(chance)))); } } diff --git a/src/main/java/forestry/core/render/EmptyStateMapper.java b/src/main/java/forestry/core/render/EmptyStateMapper.java index 809c27a01..970ce201c 100644 --- a/src/main/java/forestry/core/render/EmptyStateMapper.java +++ b/src/main/java/forestry/core/render/EmptyStateMapper.java @@ -6,7 +6,7 @@ import java.util.Map; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.statemap.IStateMapper; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/forestry/core/render/ForestryStateMapper.java b/src/main/java/forestry/core/render/ForestryStateMapper.java index 13ce41dce..32bed4e0c 100644 --- a/src/main/java/forestry/core/render/ForestryStateMapper.java +++ b/src/main/java/forestry/core/render/ForestryStateMapper.java @@ -8,7 +8,7 @@ import java.util.Map.Entry; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.statemap.IStateMapper; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; public abstract class ForestryStateMapper implements IStateMapper { diff --git a/src/main/java/forestry/core/render/MachineParticleCallback.java b/src/main/java/forestry/core/render/MachineParticleCallback.java index 6c497a095..d63c49f70 100644 --- a/src/main/java/forestry/core/render/MachineParticleCallback.java +++ b/src/main/java/forestry/core/render/MachineParticleCallback.java @@ -13,7 +13,7 @@ package forestry.core.render; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; import net.minecraft.client.particle.EntityDiggingFX; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IStringSerializable; import forestry.core.blocks.BlockBase; diff --git a/src/main/java/forestry/core/render/MachineStateMapper.java b/src/main/java/forestry/core/render/MachineStateMapper.java index 0256efba4..d35f87a4c 100644 --- a/src/main/java/forestry/core/render/MachineStateMapper.java +++ b/src/main/java/forestry/core/render/MachineStateMapper.java @@ -9,7 +9,7 @@ import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/forestry/core/render/ParticleHelper.java b/src/main/java/forestry/core/render/ParticleHelper.java index 544fafcbc..b5c520cb3 100644 --- a/src/main/java/forestry/core/render/ParticleHelper.java +++ b/src/main/java/forestry/core/render/ParticleHelper.java @@ -16,10 +16,10 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.particle.EffectRenderer; import net.minecraft.client.particle.EntityDiggingFX; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -35,7 +35,7 @@ public class ParticleHelper { private static final Random rand = new Random(); @SideOnly(Side.CLIENT) - public static boolean addHitEffects(World world, Block block, MovingObjectPosition target, EffectRenderer effectRenderer, Callback callback) { + public static boolean addHitEffects(World world, Block block, RayTraceResult target, EffectRenderer effectRenderer, Callback callback) { int x = target.getBlockPos().getX(); int y = target.getBlockPos().getY(); int z = target.getBlockPos().getZ(); diff --git a/src/main/java/forestry/core/tiles/AdjacentTileCache.java b/src/main/java/forestry/core/tiles/AdjacentTileCache.java index f69f4379d..42b54c230 100644 --- a/src/main/java/forestry/core/tiles/AdjacentTileCache.java +++ b/src/main/java/forestry/core/tiles/AdjacentTileCache.java @@ -15,7 +15,7 @@ import java.util.LinkedHashSet; import java.util.Set; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/core/tiles/IActivatable.java b/src/main/java/forestry/core/tiles/IActivatable.java index bc8bd50fc..524031cd4 100644 --- a/src/main/java/forestry/core/tiles/IActivatable.java +++ b/src/main/java/forestry/core/tiles/IActivatable.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.core.tiles; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; /* Networked tile entities that have a client side "active" flag */ public interface IActivatable { diff --git a/src/main/java/forestry/core/tiles/ILocatable.java b/src/main/java/forestry/core/tiles/ILocatable.java index 186202817..72bf34ab2 100644 --- a/src/main/java/forestry/core/tiles/ILocatable.java +++ b/src/main/java/forestry/core/tiles/ILocatable.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.core.tiles; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface ILocatable { diff --git a/src/main/java/forestry/core/tiles/TileBase.java b/src/main/java/forestry/core/tiles/TileBase.java index 5c45fe4ba..d5d5b8b63 100644 --- a/src/main/java/forestry/core/tiles/TileBase.java +++ b/src/main/java/forestry/core/tiles/TileBase.java @@ -16,7 +16,8 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.core.blocks.BlockBase; @@ -31,7 +32,7 @@ public abstract class TileBase extends TileForestry implements IHintSource { this.hints = new ArrayList<>(Config.hints.get(hintKey)); } - public void openGui(EntityPlayer player) { + public void openGui(EntityPlayer player, ItemStack heldItem) { GuiHandler.openGui(player, this); } diff --git a/src/main/java/forestry/core/tiles/TileForestry.java b/src/main/java/forestry/core/tiles/TileForestry.java index 336b7c202..f7d426c79 100644 --- a/src/main/java/forestry/core/tiles/TileForestry.java +++ b/src/main/java/forestry/core/tiles/TileForestry.java @@ -22,12 +22,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; import net.minecraft.util.ITickable; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; @@ -230,8 +230,9 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE } this.orientation = orientation; this.setNeedsNetworkUpdate(); - worldObj.notifyBlockOfStateChange(getPos(), BlockUtil.getBlock(worldObj, getPos())); - worldObj.markBlockForUpdate(getPos()); + BlockPos pos = getPos(); + worldObj.notifyBlockOfStateChange(pos, BlockUtil.getBlock(worldObj, pos)); + worldObj.markBlockRangeForRenderUpdate(pos, pos); } protected final void setNeedsNetworkUpdate() { @@ -327,8 +328,8 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE } @Override - public IChatComponent getDisplayName() { - return new ChatComponentText(getName()); + public ITextComponent getDisplayName() { + return new TextComponentTranslation(getUnlocalizedTitle()); } @Override diff --git a/src/main/java/forestry/core/tiles/TileNaturalistChest.java b/src/main/java/forestry/core/tiles/TileNaturalistChest.java index 08953741e..f6c119020 100644 --- a/src/main/java/forestry/core/tiles/TileNaturalistChest.java +++ b/src/main/java/forestry/core/tiles/TileNaturalistChest.java @@ -13,7 +13,7 @@ package forestry.core.tiles; import java.io.IOException; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import forestry.api.genetics.ISpeciesRoot; import forestry.core.gui.ContainerNaturalistInventory; @@ -26,7 +26,7 @@ import forestry.core.network.DataOutputStreamForestry; public abstract class TileNaturalistChest extends TileBase implements IPagedInventory { private static final float lidAngleVariationPerTick = 0.1F; - public static final AxisAlignedBB chestBoundingBox = AxisAlignedBB.fromBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + public static final AxisAlignedBB chestBoundingBox = new AxisAlignedBB(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); private final ISpeciesRoot speciesRoot; public float lidAngle; diff --git a/src/main/java/forestry/core/tiles/TileUtil.java b/src/main/java/forestry/core/tiles/TileUtil.java index 680852ef4..ebf1ac7bc 100644 --- a/src/main/java/forestry/core/tiles/TileUtil.java +++ b/src/main/java/forestry/core/tiles/TileUtil.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; diff --git a/src/main/java/forestry/core/utils/BlockUtil.java b/src/main/java/forestry/core/utils/BlockUtil.java index 9da2a5c55..ea8d188cf 100644 --- a/src/main/java/forestry/core/utils/BlockUtil.java +++ b/src/main/java/forestry/core/utils/BlockUtil.java @@ -23,11 +23,11 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -61,6 +61,7 @@ public abstract class BlockUtil { /** * @return The block from the pos */ + @Deprecated public static Block getBlock(IBlockAccess world, BlockPos posBlock) { return getBlockState(world, posBlock).getBlock(); } @@ -88,7 +89,7 @@ public abstract class BlockUtil { return false; } - IBlockState state = Blocks.cocoa.getDefaultState().withProperty(BlockDirectional.FACING, facing); + IBlockState state = Blocks.COCOA.getDefaultState().withProperty(BlockDirectional.FACING, facing); world.setBlockState(pos, state); return true; } @@ -107,15 +108,15 @@ public abstract class BlockUtil { pos = pos.offset(direction); IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); - if (block == Blocks.log) { + if (block == Blocks.LOG) { return state.getValue(BlockPlanks.VARIANT) == BlockPlanks.EnumType.JUNGLE; } else { return block.isWood(world, pos); } } - public static boolean isWoodSlabBlock(Block block, IBlockAccess world, BlockPos pos) { - if (block == null || block.isAir(world, pos)) { + public static boolean isWoodSlabBlock(IBlockState blockState, Block block, IBlockAccess world, BlockPos pos) { + if (blockState == null || block == null || block.isAir(blockState, world, pos)) { return false; } if(Item.getItemFromBlock(block) == null){ @@ -131,33 +132,32 @@ public abstract class BlockUtil { return false; } - public static boolean isReplaceableBlock(World world, BlockPos pos) { + public static boolean isReplaceableBlock(IBlockState blockState, World world, BlockPos pos) { Block block = world.getBlockState(pos).getBlock(); - return isReplaceableBlock(block); + return isReplaceableBlock(blockState, block); } - public static boolean isReplaceableBlock(Block block) { - return block == Blocks.vine || block == Blocks.tallgrass || block == Blocks.deadbush || block == Blocks.snow_layer - || block.getMaterial().isReplaceable(); + public static boolean isReplaceableBlock(IBlockState blockState, Block block) { + return block.getMaterial(blockState).isReplaceable(); } - public static MovingObjectPosition collisionRayTrace(@Nonnull BlockPos pos, @Nonnull Vec3 startVec, @Nonnull Vec3 endVec, @Nonnull AxisAlignedBB bounds) { + public static RayTraceResult collisionRayTrace(@Nonnull BlockPos pos, @Nonnull Vec3d startVec, @Nonnull Vec3d endVec, @Nonnull AxisAlignedBB bounds) { return collisionRayTrace(pos, startVec, endVec, bounds.minX, bounds.minY, bounds.minZ, bounds.maxX, bounds.maxY, bounds.maxZ); } /** * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. */ - public static MovingObjectPosition collisionRayTrace(@Nonnull BlockPos pos, @Nonnull Vec3 startVec, @Nonnull Vec3 endVec, double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { + public static RayTraceResult collisionRayTrace(@Nonnull BlockPos pos, @Nonnull Vec3d startVec, @Nonnull Vec3d endVec, double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { startVec = startVec.addVector(-pos.getX(), -pos.getY(), -pos.getZ()); endVec = endVec.addVector(-pos.getX(), -pos.getY(), -pos.getZ()); - Vec3 vec32 = startVec.getIntermediateWithXValue(endVec, minX); - Vec3 vec33 = startVec.getIntermediateWithXValue(endVec, maxX); - Vec3 vec34 = startVec.getIntermediateWithYValue(endVec, minY); - Vec3 vec35 = startVec.getIntermediateWithYValue(endVec, maxY); - Vec3 vec36 = startVec.getIntermediateWithZValue(endVec, minZ); - Vec3 vec37 = startVec.getIntermediateWithZValue(endVec, maxZ); + Vec3d vec32 = startVec.getIntermediateWithXValue(endVec, minX); + Vec3d vec33 = startVec.getIntermediateWithXValue(endVec, maxX); + Vec3d vec34 = startVec.getIntermediateWithYValue(endVec, minY); + Vec3d vec35 = startVec.getIntermediateWithYValue(endVec, maxY); + Vec3d vec36 = startVec.getIntermediateWithZValue(endVec, minZ); + Vec3d vec37 = startVec.getIntermediateWithZValue(endVec, maxZ); if (!isVecInsideYZBounds(vec32, minY, minZ, maxY, maxZ)) { vec32 = null; @@ -183,7 +183,7 @@ public abstract class BlockUtil { vec37 = null; } - Vec3 minHit = null; + Vec3d minHit = null; if (vec32 != null && (minHit == null || startVec.squareDistanceTo(vec32) < startVec.squareDistanceTo(minHit))) { minHit = vec32; @@ -238,28 +238,28 @@ public abstract class BlockUtil { sideHit = 3; } - return new MovingObjectPosition(minHit.addVector(pos.getX(), pos.getY(), pos.getZ()), EnumFacing.values()[sideHit], pos); + return new RayTraceResult(minHit.addVector(pos.getX(), pos.getY(), pos.getZ()), EnumFacing.values()[sideHit], pos); } } /** * Checks if a vector is within the Y and Z bounds of the block. */ - private static boolean isVecInsideYZBounds(Vec3 vec, double minY, double minZ, double maxY, double maxZ) { + private static boolean isVecInsideYZBounds(Vec3d vec, double minY, double minZ, double maxY, double maxZ) { return vec != null && vec.yCoord >= minY && vec.yCoord <= maxY && vec.zCoord >= minZ && vec.zCoord <= maxZ; } /** * Checks if a vector is within the X and Z bounds of the block. */ - private static boolean isVecInsideXZBounds(Vec3 vec, double minX, double minZ, double maxX, double maxZ) { + private static boolean isVecInsideXZBounds(Vec3d vec, double minX, double minZ, double maxX, double maxZ) { return vec != null && vec.xCoord >= minX && vec.xCoord <= maxX && vec.zCoord >= minZ && vec.zCoord <= maxZ; } /** * Checks if a vector is within the X and Y bounds of the block. */ - private static boolean isVecInsideXYBounds(Vec3 vec, double minX, double minY, double maxX, double maxY) { + private static boolean isVecInsideXYBounds(Vec3d vec, double minX, double minY, double maxX, double maxY) { return vec != null && vec.xCoord >= minX && vec.xCoord <= maxX && vec.yCoord >= minY && vec.yCoord <= maxY; } @@ -284,7 +284,7 @@ public abstract class BlockUtil { for (int k1 = minX; k1 <= maxX; ++k1) { for (int l1 = minZ; l1 <= maxZ; ++l1) { - if (!world.getChunkProvider().chunkExists(k1, l1)) { + if (world.getChunkProvider().getLoadedChunk(k1, l1) == null) { return false; } } @@ -296,42 +296,79 @@ public abstract class BlockUtil { } } - public static boolean canReplace(World world, BlockPos pos) { + public static boolean canReplace(IBlockState blockState, World world, BlockPos pos) { Block block = getBlock(world, pos); - Material material = block.getMaterial(); - return material.isReplaceable() && block.isReplaceable(world, pos) && !material.isLiquid() || block.isAir(world, pos) || material == Material.plants; + Material material = block.getMaterial(blockState); + return material.isReplaceable() && block.isReplaceable(world, pos) && !material.isLiquid() || block.isAir(blockState, world, pos) || material == Material.PLANTS; } - public static boolean canPlaceTree(World world, BlockPos pos){ + public static boolean canPlaceTree(IBlockState blockState, World world, BlockPos pos){ BlockPos downPos = pos.down(); Block block = world.getBlockState(downPos).getBlock(); - if(block.isReplaceable(world, downPos) && block.getMaterial().isLiquid() || block.isLeaves(world, downPos) || block.isWood(world, downPos)){ + if(block.isReplaceable(world, downPos) && block.getMaterial(blockState).isLiquid() || block.isLeaves(blockState, world, downPos) || block.isWood(world, downPos)){ return false; } return true; } public static BlockPos getNextReplaceableUpPos(World world, BlockPos pos){ - int x = pos.getX(); - int y = pos.getY(); - int z = pos.getZ(); - - do { - y++; - } while (!BlockUtil.canReplace(world, new BlockPos(x, y, z))); + IBlockState blockState; - return new BlockPos(x, y, z); + do { + pos = pos.up(); + blockState = world.getBlockState(pos); + } while (!BlockUtil.canReplace(blockState, world, pos)); + + return pos; } public static BlockPos getNextSolidDownPos(World world, BlockPos pos){ - int x = pos.getX(); - int y = pos.getY(); - int z = pos.getZ(); - + IBlockState blockState; + do { - y--; - } while (BlockUtil.canReplace(world, new BlockPos(x, y - 1, z))); - - return new BlockPos(x, y, z); + pos = pos.down(); + blockState = world.getBlockState(pos); + } while (BlockUtil.canReplace(blockState, world, pos)); + + return pos; + } + + /** Copied from {@link Block#shouldSideBeRendered} */ + public static boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { + AxisAlignedBB axisalignedbb = blockState.getBoundingBox(blockAccess, pos); + + switch (side) { + case DOWN: + if (axisalignedbb.minY > 0.0D) { + return true; + } + break; + case UP: + if (axisalignedbb.maxY < 1.0D) { + return true; + } + break; + case NORTH: + if (axisalignedbb.minZ > 0.0D) { + return true; + } + break; + case SOUTH: + if (axisalignedbb.maxZ < 1.0D) { + return true; + } + break; + case WEST: + if (axisalignedbb.minX > 0.0D) { + return true; + } + break; + case EAST: + if (axisalignedbb.maxX < 1.0D) { + return true; + } + } + + return !blockAccess.getBlockState(pos.offset(side)).doesSideBlockRendering(blockAccess, pos.offset(side), side.getOpposite()); } } diff --git a/src/main/java/forestry/core/utils/CamouflageUtil.java b/src/main/java/forestry/core/utils/CamouflageUtil.java index 9626f6f04..6ce4bf495 100644 --- a/src/main/java/forestry/core/utils/CamouflageUtil.java +++ b/src/main/java/forestry/core/utils/CamouflageUtil.java @@ -21,7 +21,7 @@ import forestry.core.network.DataOutputStreamForestry; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; public class CamouflageUtil { diff --git a/src/main/java/forestry/core/utils/DamageSourceForestry.java b/src/main/java/forestry/core/utils/DamageSourceForestry.java index 699f4e176..6b08c6eca 100755 --- a/src/main/java/forestry/core/utils/DamageSourceForestry.java +++ b/src/main/java/forestry/core/utils/DamageSourceForestry.java @@ -11,9 +11,9 @@ package forestry.core.utils; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.DamageSource; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentTranslation; public class DamageSourceForestry extends DamageSource { @@ -23,15 +23,15 @@ public class DamageSourceForestry extends DamageSource { } @Override - public IChatComponent getDeathMessage(EntityLivingBase living) { + public ITextComponent getDeathMessage(EntityLivingBase living) { EntityLivingBase other = living.getAttackingEntity(); String ssp = "death." + this.damageType; String smp = ssp + ".player"; if (other != null) { - return new ChatComponentTranslation(smp, living.getDisplayName(), other.getDisplayName()); + return new TextComponentTranslation(smp, living.getDisplayName(), other.getDisplayName()); } else { - return new ChatComponentTranslation(ssp, living.getDisplayName()); + return new TextComponentTranslation(ssp, living.getDisplayName()); } } diff --git a/src/main/java/forestry/core/utils/EntityUtil.java b/src/main/java/forestry/core/utils/EntityUtil.java index ecab24acb..51449c13b 100644 --- a/src/main/java/forestry/core/utils/EntityUtil.java +++ b/src/main/java/forestry/core/utils/EntityUtil.java @@ -13,7 +13,7 @@ package forestry.core.utils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.EntityRegistry; @@ -34,7 +34,7 @@ public abstract class EntityUtil { return null; } - living.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0f), 0.0f); + living.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(world.rand.nextFloat() * 360.0f), 0.0f); living.rotationYawHead = living.rotationYaw; living.renderYawOffset = living.rotationYaw; living.onInitialSpawn(null, null); @@ -49,11 +49,11 @@ public abstract class EntityUtil { } private static E createEntity(World world, Class entityClass) { - if (!EntityList.classToStringMapping.containsKey(entityClass)) { + if (!EntityList.CLASS_TO_NAME.containsKey(entityClass)) { return null; } - String entityString = EntityList.classToStringMapping.get(entityClass); + String entityString = EntityList.CLASS_TO_NAME.get(entityClass); if (entityString == null) { return null; } diff --git a/src/main/java/forestry/core/utils/GeneticsUtil.java b/src/main/java/forestry/core/utils/GeneticsUtil.java index b806abf10..a86576cf5 100644 --- a/src/main/java/forestry/core/utils/GeneticsUtil.java +++ b/src/main/java/forestry/core/utils/GeneticsUtil.java @@ -21,7 +21,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; diff --git a/src/main/java/forestry/core/utils/InventoryUtil.java b/src/main/java/forestry/core/utils/InventoryUtil.java index 3d9b74df4..55886ae74 100644 --- a/src/main/java/forestry/core/utils/InventoryUtil.java +++ b/src/main/java/forestry/core/utils/InventoryUtil.java @@ -24,7 +24,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/core/utils/ItemStackUtil.java b/src/main/java/forestry/core/utils/ItemStackUtil.java index 317808a8c..5f9b5e805 100644 --- a/src/main/java/forestry/core/utils/ItemStackUtil.java +++ b/src/main/java/forestry/core/utils/ItemStackUtil.java @@ -23,7 +23,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; diff --git a/src/main/java/forestry/core/utils/Translator.java b/src/main/java/forestry/core/utils/Translator.java index df1190500..113d6da66 100644 --- a/src/main/java/forestry/core/utils/Translator.java +++ b/src/main/java/forestry/core/utils/Translator.java @@ -2,7 +2,7 @@ package forestry.core.utils; import java.util.IllegalFormatException; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; public class Translator { private Translator() { @@ -10,15 +10,15 @@ public class Translator { } public static String translateToLocal(String key) { - if (StatCollector.canTranslate(key)) { - return StatCollector.translateToLocal(key); + if (I18n.canTranslate(key)) { + return I18n.translateToLocal(key); } else { - return StatCollector.translateToFallback(key); + return I18n.translateToFallback(key); } } public static boolean canTranslateToLocal(String key) { - return StatCollector.canTranslate(key); + return I18n.canTranslate(key); } public static String translateToLocalFormatted(String key, Object... format) { diff --git a/src/main/java/forestry/core/utils/vect/IVect.java b/src/main/java/forestry/core/utils/vect/IVect.java index 3bd844409..e48cb4054 100644 --- a/src/main/java/forestry/core/utils/vect/IVect.java +++ b/src/main/java/forestry/core/utils/vect/IVect.java @@ -11,7 +11,7 @@ package forestry.core.utils.vect; import net.minecraft.entity.Entity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import forestry.api.farming.FarmDirection; @@ -19,6 +19,7 @@ import forestry.api.farming.FarmDirection; /** * Represents a position or dimensions. */ +@Deprecated public abstract class IVect extends BlockPos { public IVect(int x, int y, int z) { diff --git a/src/main/java/forestry/core/utils/vect/MutableVect.java b/src/main/java/forestry/core/utils/vect/MutableVect.java index 2b74266d2..1cbab646d 100644 --- a/src/main/java/forestry/core/utils/vect/MutableVect.java +++ b/src/main/java/forestry/core/utils/vect/MutableVect.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.core.utils.vect; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import forestry.api.farming.FarmDirection; @@ -18,6 +18,7 @@ import forestry.api.farming.FarmDirection; /** * Represents changeable positions or dimensions. */ +@Deprecated public class MutableVect extends IVect { public int x; public int y; diff --git a/src/main/java/forestry/core/utils/vect/Vect.java b/src/main/java/forestry/core/utils/vect/Vect.java index 5c4ef7943..749c3f2f4 100644 --- a/src/main/java/forestry/core/utils/vect/Vect.java +++ b/src/main/java/forestry/core/utils/vect/Vect.java @@ -14,7 +14,7 @@ import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import forestry.api.farming.FarmDirection; @@ -22,6 +22,7 @@ import forestry.api.farming.FarmDirection; /** * Represents an unchangeable position or dimensions. */ +@Deprecated public class Vect extends IVect { public Vect(int[] dim) { diff --git a/src/main/java/forestry/core/utils/vect/VectUtil.java b/src/main/java/forestry/core/utils/vect/VectUtil.java index c1a7b0ac0..8247dfcdb 100644 --- a/src/main/java/forestry/core/utils/vect/VectUtil.java +++ b/src/main/java/forestry/core/utils/vect/VectUtil.java @@ -16,32 +16,40 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +@Deprecated public final class VectUtil { + @Deprecated public static boolean isAirBlock(World world, IVect position) { return world.isAirBlock(position); } + @Deprecated public static boolean isWoodBlock(World world, IVect position) { Block block = getBlock(world, position); return block.isWood(world, position); } + @Deprecated public static TileEntity getTile(World world, IVect position) { return world.getTileEntity(position); } - + + @Deprecated public static IBlockState getBlockState(World world, IVect position) { return world.getBlockState(position); } + @Deprecated public static Block getBlock(World world, IVect position) { return getBlockState(world, position).getBlock(); } + @Deprecated public static int getBlockMeta(World world, IVect position) { return getBlock(world, position).getMetaFromState(getBlockState(world, position)); } + @Deprecated public static ItemStack getAsItemStack(World world, IVect position) { return new ItemStack(getBlock(world, position), 1, getBlockMeta(world, position)); } diff --git a/src/main/java/forestry/core/worldgen/BlockType.java b/src/main/java/forestry/core/worldgen/BlockType.java index 026895a6b..d28473a23 100755 --- a/src/main/java/forestry/core/worldgen/BlockType.java +++ b/src/main/java/forestry/core/worldgen/BlockType.java @@ -11,7 +11,7 @@ package forestry.core.worldgen; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/core/worldgen/BlockTypeTileForestry.java b/src/main/java/forestry/core/worldgen/BlockTypeTileForestry.java index c2d1d565c..434e19941 100644 --- a/src/main/java/forestry/core/worldgen/BlockTypeTileForestry.java +++ b/src/main/java/forestry/core/worldgen/BlockTypeTileForestry.java @@ -12,7 +12,7 @@ package forestry.core.worldgen; import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/core/worldgen/BlockTypeVoid.java b/src/main/java/forestry/core/worldgen/BlockTypeVoid.java index b5ba918eb..5f7e695dc 100644 --- a/src/main/java/forestry/core/worldgen/BlockTypeVoid.java +++ b/src/main/java/forestry/core/worldgen/BlockTypeVoid.java @@ -11,7 +11,7 @@ package forestry.core.worldgen; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockTypeVoid extends BlockType { diff --git a/src/main/java/forestry/core/worldgen/IBlockType.java b/src/main/java/forestry/core/worldgen/IBlockType.java index 10daab414..e5581d191 100644 --- a/src/main/java/forestry/core/worldgen/IBlockType.java +++ b/src/main/java/forestry/core/worldgen/IBlockType.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.core.worldgen; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/core/worldgen/WorldGenBase.java b/src/main/java/forestry/core/worldgen/WorldGenBase.java index 311e36bc9..8ecdaa28f 100755 --- a/src/main/java/forestry/core/worldgen/WorldGenBase.java +++ b/src/main/java/forestry/core/worldgen/WorldGenBase.java @@ -12,7 +12,7 @@ package forestry.core.worldgen; import java.util.Random; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java b/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java deleted file mode 100755 index 8f2ea755a..000000000 --- a/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ -package forestry.core.worldgen; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenerator; - -import forestry.core.config.Constants; - -public class WorldGenMinableMeta extends WorldGenerator { - - private final Block mineableBlock; - private final int mineableBlockMeta; - private final int numberOfBlocks; - - public WorldGenMinableMeta(Block block, int meta, int numberOfBlocks) { - mineableBlock = block; - mineableBlockMeta = meta; - this.numberOfBlocks = numberOfBlocks; - } - - @Override - public boolean generate(World world, Random random, BlockPos pos) { - - boolean hasGenerated = false; - - float randomBase = random.nextFloat() * 3.141593F; - double d = pos.getX() + 8 + MathHelper.sin(randomBase) * numberOfBlocks / 8F; - double d1 = pos.getX() + 8 - MathHelper.sin(randomBase) * numberOfBlocks / 8F; - double d2 = pos.getZ() + 8 + MathHelper.cos(randomBase) * numberOfBlocks / 8F; - double d3 = pos.getZ() + 8 - MathHelper.cos(randomBase) * numberOfBlocks / 8F; - double d4 = pos.getY() + random.nextInt(3) - 2; - double d5 = pos.getY() + random.nextInt(3) - 2; - - for (int l = 0; l <= numberOfBlocks; l++) { - double d6 = d + (d1 - d) * l / numberOfBlocks; - double d7 = d4 + (d5 - d4) * l / numberOfBlocks; - double d8 = d2 + (d3 - d2) * l / numberOfBlocks; - double d9 = random.nextDouble() * numberOfBlocks / 16D; - double d10 = (MathHelper.sin(l * 3.141593F / numberOfBlocks) + 1.0F) * d9 + 1.0D; - double d11 = (MathHelper.sin(l * 3.141593F / numberOfBlocks) + 1.0F) * d9 + 1.0D; - int xStart = MathHelper.floor_double(d6 - d10 / 2D); - int yStart = MathHelper.floor_double(d7 - d11 / 2D); - int zStart = MathHelper.floor_double(d8 - d10 / 2D); - int xEnd = MathHelper.floor_double(d6 + d10 / 2D); - int yEnd = MathHelper.floor_double(d7 + d11 / 2D); - int zEnd = MathHelper.floor_double(d8 + d10 / 2D); - - for (int targetX = xStart; targetX <= xEnd; targetX++) { - double d12 = (targetX + 0.5D - d6) / (d10 / 2D); - if (d12 * d12 >= 1.0D) { - continue; - } - - for (int targetY = yStart; targetY <= yEnd; targetY++) { - double d13 = (targetY + 0.5D - d7) / (d11 / 2D); - if (d12 * d12 + d13 * d13 >= 1.0D) { - continue; - } - - for (int targetZ = zStart; targetZ <= zEnd; targetZ++) { - double d14 = (targetZ + 0.5D - d8) / (d10 / 2D); - BlockPos target = new BlockPos(targetX, targetY, targetZ); - if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlockState(target).getBlock() == Blocks.stone) { - world.setBlockState(target, mineableBlock.getStateFromMeta(mineableBlockMeta), Constants.FLAG_BLOCK_SYNCH); - hasGenerated = true; - } - } - } - } - } - - return hasGenerated; - } - -} diff --git a/src/main/java/forestry/core/worldgen/WorldGenerator.java b/src/main/java/forestry/core/worldgen/WorldGenerator.java index 566bf0137..04302bd32 100644 --- a/src/main/java/forestry/core/worldgen/WorldGenerator.java +++ b/src/main/java/forestry/core/worldgen/WorldGenerator.java @@ -12,9 +12,12 @@ package forestry.core.worldgen; import java.util.Random; -import net.minecraft.util.BlockPos; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.PopulateChunkEvent; @@ -22,29 +25,30 @@ import net.minecraftforge.fml.common.IWorldGenerator; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import forestry.core.PluginCore; +import forestry.core.blocks.BlockResourceOre; import forestry.core.blocks.EnumResourceType; import forestry.core.config.Config; import forestry.plugins.PluginManager; public class WorldGenerator implements IWorldGenerator { - private WorldGenMinableMeta apatiteGenerator; - private WorldGenMinableMeta copperGenerator; - private WorldGenMinableMeta tinGenerator; + private WorldGenMinable apatiteGenerator; + private WorldGenMinable copperGenerator; + private WorldGenMinable tinGenerator; public WorldGenerator() { MinecraftForge.EVENT_BUS.register(this); } @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { generateWorld(random, chunkX, chunkZ, world); } @SubscribeEvent public void populateChunk(PopulateChunkEvent.Post event) { // / PLUGIN WORLD GENERATION - PluginManager.populateChunk(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated); + PluginManager.populateChunk(event.getGen(), event.getWorld(), event.getRand(), event.getChunkX(), event.getChunkZ(), event.isHasVillageGenerated()); } public void retroGen(Random random, int chunkX, int chunkZ, World world) { @@ -56,9 +60,14 @@ public class WorldGenerator implements IWorldGenerator { private void generateWorld(Random random, int chunkX, int chunkZ, World world) { if (apatiteGenerator == null) { - apatiteGenerator = new WorldGenMinableMeta(PluginCore.blocks.resources, EnumResourceType.APATITE.getMeta(), 36); - copperGenerator = new WorldGenMinableMeta(PluginCore.blocks.resources, EnumResourceType.COPPER.getMeta(), 6); - tinGenerator = new WorldGenMinableMeta(PluginCore.blocks.resources, EnumResourceType.TIN.getMeta(), 6); + BlockResourceOre resourcesBlock = PluginCore.blocks.resources; + + IBlockState apatiteBlockState = resourcesBlock.getStateFromMeta(EnumResourceType.APATITE.getMeta()); + IBlockState copperBlockState = resourcesBlock.getStateFromMeta(EnumResourceType.COPPER.getMeta()); + IBlockState tinBlockState = resourcesBlock.getStateFromMeta(EnumResourceType.TIN.getMeta()); + apatiteGenerator = new WorldGenMinable(apatiteBlockState, 36); + copperGenerator = new WorldGenMinable(copperBlockState, 6); + tinGenerator = new WorldGenMinable(tinBlockState, 6); } // shift to world coordinates diff --git a/src/main/java/forestry/energy/blocks/BlockEngine.java b/src/main/java/forestry/energy/blocks/BlockEngine.java index 24df5291f..079d5a271 100644 --- a/src/main/java/forestry/energy/blocks/BlockEngine.java +++ b/src/main/java/forestry/energy/blocks/BlockEngine.java @@ -17,11 +17,11 @@ import java.util.List; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import forestry.core.blocks.BlockBase; @@ -33,22 +33,22 @@ public class BlockEngine extends BlockBase { static { boundingBoxesForDirections.put(EnumFacing.DOWN, ImmutableList.of( - AxisAlignedBB.fromBounds(0.0, 0.5, 0.0, 1.0, 1.0, 1.0), AxisAlignedBB.fromBounds(0.25, 0.0, 0.25, 0.75, 0.5, 0.75) + new AxisAlignedBB(0.0, 0.5, 0.0, 1.0, 1.0, 1.0), new AxisAlignedBB(0.25, 0.0, 0.25, 0.75, 0.5, 0.75) )); boundingBoxesForDirections.put(EnumFacing.UP, ImmutableList.of( - AxisAlignedBB.fromBounds(0.0, 0.0, 0.0, 1.0, 0.5, 1.0), AxisAlignedBB.fromBounds(0.25, 0.5, 0.25, 0.75, 1.0, 0.75) + new AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 0.5, 1.0), new AxisAlignedBB(0.25, 0.5, 0.25, 0.75, 1.0, 0.75) )); boundingBoxesForDirections.put(EnumFacing.NORTH, ImmutableList.of( - AxisAlignedBB.fromBounds(0.0, 0.0, 0.5, 1.0, 1.0, 1.0), AxisAlignedBB.fromBounds(0.25, 0.25, 0.0, 0.75, 0.75, 0.5) + new AxisAlignedBB(0.0, 0.0, 0.5, 1.0, 1.0, 1.0), new AxisAlignedBB(0.25, 0.25, 0.0, 0.75, 0.75, 0.5) )); boundingBoxesForDirections.put(EnumFacing.SOUTH, ImmutableList.of( - AxisAlignedBB.fromBounds(0.0, 0.0, 0.0, 1.0, 1.0, 0.5), AxisAlignedBB.fromBounds(0.25, 0.25, 0.5, 0.75, 0.75, 1.0) + new AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 1.0, 0.5), new AxisAlignedBB(0.25, 0.25, 0.5, 0.75, 0.75, 1.0) )); boundingBoxesForDirections.put(EnumFacing.WEST, ImmutableList.of( - AxisAlignedBB.fromBounds(0.5, 0.0, 0.0, 1.0, 1.0, 1.0), AxisAlignedBB.fromBounds(0.0, 0.25, 0.25, 0.5, 0.75, 0.75) + new AxisAlignedBB(0.5, 0.0, 0.0, 1.0, 1.0, 1.0), new AxisAlignedBB(0.0, 0.25, 0.25, 0.5, 0.75, 0.75) )); boundingBoxesForDirections.put(EnumFacing.EAST, ImmutableList.of( - AxisAlignedBB.fromBounds(0.0, 0.0, 0.0, 0.5, 1.0, 1.0), AxisAlignedBB.fromBounds(0.5, 0.25, 0.25, 1.0, 0.75, 0.75) + new AxisAlignedBB(0.0, 0.0, 0.0, 0.5, 1.0, 1.0), new AxisAlignedBB(0.5, 0.25, 0.25, 1.0, 0.75, 0.75) )); } @@ -57,10 +57,10 @@ public class BlockEngine extends BlockBase { } @Override - public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) { - TileEngine tile = TileUtil.getTile(world, pos, TileEngine.class); + public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn) { + TileEngine tile = TileUtil.getTile(worldIn, pos, TileEngine.class); if (tile == null) { - super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); + super.addCollisionBoxToList(state, worldIn, pos, entityBox, collidingBoxes, entityIn); return; } @@ -72,29 +72,29 @@ public class BlockEngine extends BlockBase { for (AxisAlignedBB boundingBoxBase : boundingBoxes) { AxisAlignedBB boundingBox = boundingBoxBase.offset(pos.getX(), pos.getY(), pos.getZ()); - if (mask.intersectsWith(boundingBox)) { - list.add(boundingBox); + if (entityBox.intersectsWith(boundingBox)) { + collidingBoxes.add(boundingBox); } } } @Override - public MovingObjectPosition collisionRayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) { - TileEngine tile = TileUtil.getTile(world, pos, TileEngine.class); + public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) { + TileEngine tile = TileUtil.getTile(worldIn, pos, TileEngine.class); if (tile == null) { - return super.collisionRayTrace(world, pos, start, end); + return super.collisionRayTrace(blockState, worldIn, pos, start, end); } EnumFacing orientation = tile.getOrientation(); List boundingBoxes = boundingBoxesForDirections.get(orientation); if (boundingBoxes == null) { - return super.collisionRayTrace(world, pos, start, end); + return super.collisionRayTrace(blockState, worldIn, pos, start, end); } - MovingObjectPosition nearestIntersection = null; + RayTraceResult nearestIntersection = null; for (AxisAlignedBB boundingBoxBase : boundingBoxes) { AxisAlignedBB boundingBox = boundingBoxBase.offset(pos.getX(), pos.getY(), pos.getZ()); - MovingObjectPosition intersection = boundingBox.calculateIntercept(start, end); + RayTraceResult intersection = boundingBox.calculateIntercept(start, end); if (intersection != null) { if (nearestIntersection == null || intersection.hitVec.distanceTo(start) < nearestIntersection.hitVec.distanceTo(start)) { nearestIntersection = intersection; @@ -105,7 +105,7 @@ public class BlockEngine extends BlockBase { if (nearestIntersection != null) { Object hitInfo = nearestIntersection.hitInfo; Entity entityHit = nearestIntersection.entityHit; - nearestIntersection = new MovingObjectPosition(nearestIntersection.typeOfHit, nearestIntersection.hitVec, nearestIntersection.sideHit, pos); + nearestIntersection = new RayTraceResult(nearestIntersection.typeOfHit, nearestIntersection.hitVec, nearestIntersection.sideHit, pos); nearestIntersection.hitInfo = hitInfo; nearestIntersection.entityHit = entityHit; } diff --git a/src/main/java/forestry/energy/blocks/MachinePropertiesEngine.java b/src/main/java/forestry/energy/blocks/MachinePropertiesEngine.java index a51d6d820..262352e79 100644 --- a/src/main/java/forestry/energy/blocks/MachinePropertiesEngine.java +++ b/src/main/java/forestry/energy/blocks/MachinePropertiesEngine.java @@ -4,7 +4,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; diff --git a/src/main/java/forestry/factory/gui/widgets/MemorizedRecipeSlot.java b/src/main/java/forestry/factory/gui/widgets/MemorizedRecipeSlot.java index 363b4595b..2e39c3990 100644 --- a/src/main/java/forestry/factory/gui/widgets/MemorizedRecipeSlot.java +++ b/src/main/java/forestry/factory/gui/widgets/MemorizedRecipeSlot.java @@ -45,7 +45,7 @@ public class MemorizedRecipeSlot extends ItemStackWidgetBase { GlStateManager.disableDepth(); if (recipeMemory.isLocked(slotNumber)) { - Proxies.render.bindTexture(TextureMap.locationBlocksTexture); + Proxies.render.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, lockIcon, 16, 16); } diff --git a/src/main/java/forestry/farming/blocks/BlockFarm.java b/src/main/java/forestry/farming/blocks/BlockFarm.java index f60b186c9..5557a1728 100644 --- a/src/main/java/forestry/farming/blocks/BlockFarm.java +++ b/src/main/java/forestry/farming/blocks/BlockFarm.java @@ -16,9 +16,9 @@ import java.util.List; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -26,10 +26,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -60,7 +60,7 @@ public class BlockFarm extends BlockStructure { public static final PropertyEnum META = PropertyEnum.create("meta", EnumFarmBlockType.class); public BlockFarm() { - super(Material.rock); + super(Material.ROCK); setHardness(1.0f); setHarvestLevel("pickaxe", 0); setDefaultState(blockState.getBaseState().withProperty(META, EnumFarmBlockType.PLAIN)); @@ -85,7 +85,7 @@ public class BlockFarm extends BlockStructure { } @Override - protected BlockState createBlockState() { + protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[]{META}, new IUnlistedProperty[]{UnlistedBlockPos.POS, UnlistedBlockAccess.BLOCKACCESS}); } @@ -107,12 +107,12 @@ public class BlockFarm extends BlockStructure { } } } - + @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) { + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { List drops = getDrops(world, pos, BlockUtil.getBlockState(world, pos), 0); if (drops.isEmpty()) { - return super.getPickBlock(target, world, pos, player); + return super.getPickBlock(state, target, world, pos, player); } return drops.get(0); } @@ -131,7 +131,6 @@ public class BlockFarm extends BlockStructure { @Override public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { - int meta = BlockUtil.getBlockMetadata(world, pos); if (!world.isRemote && canHarvestBlock(world, pos, player)) { List drops = getDrops(world, pos, BlockUtil.getBlockState(world, pos), 0); for (ItemStack drop : drops) { @@ -158,12 +157,6 @@ public class BlockFarm extends BlockStructure { return drops; } - @Override - public int getDamageValue(World world, BlockPos pos) { - int meta = getMetaFromState(world.getBlockState(pos)); - return meta != 1 ? meta : 0; - } - @Override public TileEntity createNewTileEntity(World world, int meta) { switch (meta) { @@ -183,8 +176,8 @@ public class BlockFarm extends BlockStructure { /* MODELS */ @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() { - return EnumWorldBlockLayer.CUTOUT; + public BlockRenderLayer getBlockLayer() { + return BlockRenderLayer.CUTOUT; } @SideOnly(Side.CLIENT) @@ -199,8 +192,9 @@ public class BlockFarm extends BlockStructure { } @Override - public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) { - return getMetaFromState(world.getBlockState(pos)) == 5; + public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { + IBlockState blockState = world.getBlockState(pos); + return blockState.getValue(META) == EnumFarmBlockType.CONTROL; } public ItemStack get(EnumFarmBlockType type, int amount) { diff --git a/src/main/java/forestry/farming/blocks/BlockMushroom.java b/src/main/java/forestry/farming/blocks/BlockMushroom.java index 7a26d5d58..999e7bb6a 100644 --- a/src/main/java/forestry/farming/blocks/BlockMushroom.java +++ b/src/main/java/forestry/farming/blocks/BlockMushroom.java @@ -14,18 +14,18 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -import net.minecraft.block.Block; import net.minecraft.block.BlockBush; +import net.minecraft.block.BlockDirt; import net.minecraft.block.IGrowable; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenBigMushroom; @@ -58,16 +58,16 @@ public class BlockMushroom extends BlockBush implements IItemModelRegister, IGro public BlockMushroom() { setHardness(0.0f); - this.generators = new WorldGenerator[]{new WorldGenBigMushroom(Blocks.brown_mushroom_block), new WorldGenBigMushroom(Blocks.red_mushroom_block)}; - this.drops = new ItemStack[]{new ItemStack(Blocks.brown_mushroom), new ItemStack(Blocks.red_mushroom)}; + this.generators = new WorldGenerator[]{new WorldGenBigMushroom(Blocks.BROWN_MUSHROOM_BLOCK), new WorldGenBigMushroom(Blocks.RED_MUSHROOM_BLOCK)}; + this.drops = new ItemStack[]{new ItemStack(Blocks.BROWN_MUSHROOM), new ItemStack(Blocks.RED_MUSHROOM)}; setCreativeTab(null); setDefaultState(this.blockState.getBaseState().withProperty(MUSHROOM, MushroomType.BROWN)); setTickRandomly(true); } @Override - protected BlockState createBlockState() { - return new BlockState(this, MUSHROOM); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, MUSHROOM); } @Override @@ -88,7 +88,7 @@ public class BlockMushroom extends BlockBush implements IItemModelRegister, IGro // / DROPS @Override public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { - ArrayList ret = new ArrayList<>(); + List ret = new ArrayList<>(); MushroomType type = getTypeFromMeta(state.getBlock().getMetaFromState(state)); @@ -98,8 +98,23 @@ public class BlockMushroom extends BlockBush implements IItemModelRegister, IGro } @Override - protected boolean canPlaceBlockOn(Block block) { - return block == Blocks.mycelium; + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { + return super.canPlaceBlockAt(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getDefaultState()); + } + + @Override + protected boolean canSustainBush(IBlockState state) { + return state.isFullBlock(); + } + + @Override + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) { + if (pos.getY() >= 0 && pos.getY() < 256) { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + return iblockstate.getBlock() == Blocks.MYCELIUM || (iblockstate.getBlock() == Blocks.DIRT && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL || worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this)); + } else { + return false; + } } @Override diff --git a/src/main/java/forestry/farming/gui/FarmLedger.java b/src/main/java/forestry/farming/gui/FarmLedger.java index 4605af9d8..f6eed84f4 100644 --- a/src/main/java/forestry/farming/gui/FarmLedger.java +++ b/src/main/java/forestry/farming/gui/FarmLedger.java @@ -10,8 +10,12 @@ ******************************************************************************/ package forestry.farming.gui; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ItemModelMesher; +import net.minecraft.client.renderer.RenderItem; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -44,8 +48,16 @@ public class FarmLedger extends Ledger { int xHeader = x + 22; // Draw icon - IBakedModel iBakedModel = Proxies.common.getClientInstance().getRenderItem().getItemModelMesher().getItemModel(new ItemStack(Items.water_bucket)); - TextureAtlasSprite textureAtlasSprite = Proxies.common.getClientInstance().getTextureMapBlocks().getAtlasSprite(iBakedModel.getParticleTexture().getIconName()); + Minecraft minecraft = Proxies.common.getClientInstance(); + RenderItem renderItem = minecraft.getRenderItem(); + ItemModelMesher itemModelMesher = renderItem.getItemModelMesher(); + IBakedModel iBakedModel = itemModelMesher.getItemModel(new ItemStack(Items.WATER_BUCKET)); + + TextureMap textureMapBlocks = minecraft.getTextureMapBlocks(); + TextureAtlasSprite particleTexture = iBakedModel.getParticleTexture(); + String particleTextureIconName = particleTexture.getIconName(); + TextureAtlasSprite textureAtlasSprite = textureMapBlocks.getAtlasSprite(particleTextureIconName); + drawSprite(textureAtlasSprite, xIcon, y); y += 4; diff --git a/src/main/java/forestry/farming/gui/widgets/FarmLogicSlot.java b/src/main/java/forestry/farming/gui/widgets/FarmLogicSlot.java index da36ff0fe..f30912201 100644 --- a/src/main/java/forestry/farming/gui/widgets/FarmLogicSlot.java +++ b/src/main/java/forestry/farming/gui/widgets/FarmLogicSlot.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.farming.gui.widgets; -import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.RenderItem; import net.minecraft.item.ItemStack; import forestry.api.farming.FarmDirection; diff --git a/src/main/java/forestry/farming/logic/Crop.java b/src/main/java/forestry/farming/logic/Crop.java index 797311b4c..5f3e1c939 100755 --- a/src/main/java/forestry/farming/logic/Crop.java +++ b/src/main/java/forestry/farming/logic/Crop.java @@ -33,8 +33,13 @@ public abstract class Crop implements ICrop { this.position = position; } + protected final void setBlock(Vect position, IBlockState blockState) { + world.setBlockState(position, blockState, Constants.FLAG_BLOCK_SYNCH); + } + + @Deprecated protected final void setBlock(Vect position, Block block, int meta) { - world.setBlockState(position, block.getStateFromMeta(meta), Constants.FLAG_BLOCK_SYNCH); + setBlock(position, block.getStateFromMeta(meta)); } protected final Block getBlock(Vect position) { diff --git a/src/main/java/forestry/farming/logic/CropBasicAgriCraft.java b/src/main/java/forestry/farming/logic/CropBasicAgriCraft.java index 6d1e50b2f..9a82945bb 100644 --- a/src/main/java/forestry/farming/logic/CropBasicAgriCraft.java +++ b/src/main/java/forestry/farming/logic/CropBasicAgriCraft.java @@ -45,8 +45,8 @@ public class CropBasicAgriCraft extends Crop { harvest.remove(1); //AgriCraft returns cropsticks in 0, seeds in 1 in getDrops, removing since harvesting doesn't return them. } harvest.remove(0); - Proxies.common.addBlockDestroyEffects(world, pos, Blocks.melon_block.getStateFromMeta(0)); - world.setBlockState(pos, getBlock(pos).getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH); + Proxies.common.addBlockDestroyEffects(world, pos, Blocks.MELON_BLOCK.getDefaultState()); + world.setBlockState(pos, getBlock(pos).getDefaultState(), Constants.FLAG_BLOCK_SYNCH); return harvest; } diff --git a/src/main/java/forestry/farming/logic/CropBasicFruit.java b/src/main/java/forestry/farming/logic/CropBasicFruit.java index b5d9b5c08..8445bd1e1 100644 --- a/src/main/java/forestry/farming/logic/CropBasicFruit.java +++ b/src/main/java/forestry/farming/logic/CropBasicFruit.java @@ -39,8 +39,8 @@ public class CropBasicFruit extends Crop { @Override protected Collection harvestBlock(Vect pos) { Collection harvested = block.getDrops(world, pos, block.getStateFromMeta(meta), 0); - Proxies.common.addBlockDestroyEffects(world, pos, block.getStateFromMeta(0)); - world.setBlockState(pos, block.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH); + Proxies.common.addBlockDestroyEffects(world, pos, block.getDefaultState()); + world.setBlockState(pos, block.getDefaultState(), Constants.FLAG_BLOCK_SYNCH); return harvested; } diff --git a/src/main/java/forestry/farming/logic/CropBasicGrowthCraft.java b/src/main/java/forestry/farming/logic/CropBasicGrowthCraft.java index 6b08cc7ab..51c68a134 100644 --- a/src/main/java/forestry/farming/logic/CropBasicGrowthCraft.java +++ b/src/main/java/forestry/farming/logic/CropBasicGrowthCraft.java @@ -47,12 +47,12 @@ public class CropBasicGrowthCraft extends Crop { if (harvest.size() > 1) { harvest.remove(0); //Hops have rope as first drop. } - Proxies.common.addBlockDestroyEffects(world, pos, block.getStateFromMeta(0)); + Proxies.common.addBlockDestroyEffects(world, pos, block.getDefaultState()); if (isGrape) { world.setBlockToAir(pos); } else { - world.setBlockState(pos, block.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH); + world.setBlockState(pos, block.getDefaultState(), Constants.FLAG_BLOCK_SYNCH); } if (isRice) { diff --git a/src/main/java/forestry/farming/logic/CropBlock.java b/src/main/java/forestry/farming/logic/CropBlock.java index c89951c74..88df3f9aa 100755 --- a/src/main/java/forestry/farming/logic/CropBlock.java +++ b/src/main/java/forestry/farming/logic/CropBlock.java @@ -38,7 +38,7 @@ public class CropBlock extends Crop { @Override protected Collection harvestBlock(Vect pos) { Collection harvested = block.getDrops(world, pos, block.getStateFromMeta(meta), 0); - Proxies.common.addBlockDestroyEffects(world, pos, block.getStateFromMeta(0)); + Proxies.common.addBlockDestroyEffects(world, pos, block.getDefaultState()); // Block.breakBlock() is called by vanilla itself, removing TEs. world.setBlockToAir(pos); return harvested; diff --git a/src/main/java/forestry/farming/logic/CropFruit.java b/src/main/java/forestry/farming/logic/CropFruit.java index ed56e01ec..fd8f2ed46 100755 --- a/src/main/java/forestry/farming/logic/CropFruit.java +++ b/src/main/java/forestry/farming/logic/CropFruit.java @@ -53,7 +53,7 @@ public class CropFruit extends Crop { } Proxies.common.sendFXSignal(PacketFXSignal.VisualFXType.BLOCK_DESTROY, PacketFXSignal.SoundFXType.LEAF, world, pos, - getBlock(pos).getStateFromMeta(0)); + getBlock(pos).getDefaultState()); return ((IFruitBearer) tile).pickFruit(null); } diff --git a/src/main/java/forestry/farming/logic/CropPeat.java b/src/main/java/forestry/farming/logic/CropPeat.java index c0e45430f..222987bc2 100755 --- a/src/main/java/forestry/farming/logic/CropPeat.java +++ b/src/main/java/forestry/farming/logic/CropPeat.java @@ -47,8 +47,8 @@ public class CropPeat extends Crop { List drops = new ArrayList<>(); drops.add(PluginCore.items.peat.getItemStack()); - Proxies.common.addBlockDestroyEffects(world, pos, getBlock(pos).getStateFromMeta(0)); - setBlock(pos, Blocks.dirt, 0); + Proxies.common.addBlockDestroyEffects(world, pos, getBlock(pos).getDefaultState()); + setBlock(pos, Blocks.DIRT, 0); return drops; } diff --git a/src/main/java/forestry/farming/logic/CropRubber.java b/src/main/java/forestry/farming/logic/CropRubber.java index 345ae1078..17b5d592b 100755 --- a/src/main/java/forestry/farming/logic/CropRubber.java +++ b/src/main/java/forestry/farming/logic/CropRubber.java @@ -32,7 +32,7 @@ public class CropRubber extends CropBlock { protected Collection harvestBlock(Vect pos) { Collection harvested = new ArrayList<>(); harvested.add(PluginIC2.resin.copy()); - Proxies.common.addBlockDestroyEffects(world, pos, block.getStateFromMeta(0)); + Proxies.common.addBlockDestroyEffects(world, pos, block.getDefaultState()); world.setBlockState(pos, block.getStateFromMeta(meta + 6), Constants.FLAG_BLOCK_SYNCH); return harvested; } diff --git a/src/main/java/forestry/farming/logic/FarmLogic.java b/src/main/java/forestry/farming/logic/FarmLogic.java index 8b519237b..a43abac8e 100755 --- a/src/main/java/forestry/farming/logic/FarmLogic.java +++ b/src/main/java/forestry/farming/logic/FarmLogic.java @@ -10,18 +10,20 @@ ******************************************************************************/ package forestry.farming.logic; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -31,6 +33,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import forestry.api.farming.FarmDirection; import forestry.api.farming.IFarmHousing; import forestry.api.farming.IFarmLogic; +import forestry.arboriculture.blocks.BlockFruitPod; import forestry.core.config.Constants; import forestry.core.entities.EntitySelector; import forestry.core.utils.BlockUtil; @@ -58,7 +61,7 @@ public abstract class FarmLogic implements IFarmLogic { @SideOnly(Side.CLIENT) @Override public ResourceLocation getTextureMap() { - return TextureMap.locationBlocksTexture; + return TextureMap.LOCATION_BLOCKS_TEXTURE; } @Override @@ -77,12 +80,13 @@ public abstract class FarmLogic implements IFarmLogic { public abstract boolean isAcceptedWindfall(ItemStack stack); - protected final boolean isAirBlock(Block block) { - return block.getMaterial() == Material.air; + @Deprecated + protected final boolean isAirBlock(@Nonnull Block block, @Nonnull IBlockState blockState, @Nonnull World world, @Nonnull BlockPos blockPos) { + return block.isAir(blockState, world, blockPos); } protected final boolean isWaterSourceBlock(World world, Vect position) { - return BlockUtil.getBlock(world, position) == Blocks.water && + return BlockUtil.getBlock(world, position) == Blocks.WATER && BlockUtil.getBlockMetadata(world, position) == 0; } @@ -111,7 +115,7 @@ public abstract class FarmLogic implements IFarmLogic { maxY = getWorld().getHeight(); } - return AxisAlignedBB.fromBounds(min.getX(), min.getY(), min.getZ(), max.getX(), maxY, max.getZ()); + return new AxisAlignedBB(min.getX(), min.getY(), min.getZ(), max.getX(), maxY, max.getZ()); } protected List collectEntityItems(boolean toWorldHeight) { diff --git a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java index 1cc937d20..bcd083b58 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java +++ b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java @@ -22,7 +22,7 @@ import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/forestry/farming/logic/FarmLogicCocoa.java b/src/main/java/forestry/farming/logic/FarmLogicCocoa.java index 7bf50f5d0..194d1a4d8 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicCocoa.java +++ b/src/main/java/forestry/farming/logic/FarmLogicCocoa.java @@ -22,7 +22,7 @@ import net.minecraft.block.BlockPlanks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/farming/logic/FarmLogicCrops.java b/src/main/java/forestry/farming/logic/FarmLogicCrops.java index 67c2facd6..25295fae2 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicCrops.java +++ b/src/main/java/forestry/farming/logic/FarmLogicCrops.java @@ -15,7 +15,7 @@ import java.util.Stack; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; diff --git a/src/main/java/forestry/farming/logic/FarmLogicEnder.java b/src/main/java/forestry/farming/logic/FarmLogicEnder.java index dc9d3f8ec..f97fe64f3 100644 --- a/src/main/java/forestry/farming/logic/FarmLogicEnder.java +++ b/src/main/java/forestry/farming/logic/FarmLogicEnder.java @@ -17,7 +17,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/forestry/farming/logic/FarmLogicGourd.java b/src/main/java/forestry/farming/logic/FarmLogicGourd.java index 0718bd2db..16193c39e 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicGourd.java +++ b/src/main/java/forestry/farming/logic/FarmLogicGourd.java @@ -16,7 +16,7 @@ import java.util.Stack; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java b/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java index d36ef63c6..6d65d7c43 100644 --- a/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java +++ b/src/main/java/forestry/farming/logic/FarmLogicHomogeneous.java @@ -15,7 +15,7 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.farming.FarmDirection; diff --git a/src/main/java/forestry/farming/logic/FarmLogicInfernal.java b/src/main/java/forestry/farming/logic/FarmLogicInfernal.java index 657dc8dbe..1753c4726 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicInfernal.java +++ b/src/main/java/forestry/farming/logic/FarmLogicInfernal.java @@ -17,7 +17,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java index 200df8c6c..dab4f7eb9 100644 --- a/src/main/java/forestry/farming/logic/FarmLogicOrchard.java +++ b/src/main/java/forestry/farming/logic/FarmLogicOrchard.java @@ -24,7 +24,7 @@ import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -58,7 +58,7 @@ public class FarmLogicOrchard extends FarmLogic { // traversalBlocksBuilder.add(Blocks.dirt); // } // if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.PLANTMEGAPACK)) { - // traversalBlocksBuilder.add(Blocks.water); + // traversalBlocksBuilder.add(Blocks.WATER); // } // // { diff --git a/src/main/java/forestry/farming/logic/FarmLogicPeat.java b/src/main/java/forestry/farming/logic/FarmLogicPeat.java index f817bd694..dbbc819ad 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicPeat.java +++ b/src/main/java/forestry/farming/logic/FarmLogicPeat.java @@ -16,7 +16,7 @@ import java.util.Stack; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/forestry/farming/logic/FarmLogicReeds.java b/src/main/java/forestry/farming/logic/FarmLogicReeds.java index 04439a3b5..a284f787c 100644 --- a/src/main/java/forestry/farming/logic/FarmLogicReeds.java +++ b/src/main/java/forestry/farming/logic/FarmLogicReeds.java @@ -17,7 +17,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/forestry/farming/logic/FarmLogicRubber.java b/src/main/java/forestry/farming/logic/FarmLogicRubber.java index f8dbf3ea3..a822d43e2 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicRubber.java +++ b/src/main/java/forestry/farming/logic/FarmLogicRubber.java @@ -21,7 +21,7 @@ import net.minecraft.block.Block; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/forestry/farming/logic/FarmLogicSucculent.java b/src/main/java/forestry/farming/logic/FarmLogicSucculent.java index ed6af9b7a..ec55a989f 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicSucculent.java +++ b/src/main/java/forestry/farming/logic/FarmLogicSucculent.java @@ -17,7 +17,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/forestry/farming/logic/FarmLogicWatered.java b/src/main/java/forestry/farming/logic/FarmLogicWatered.java index 7dceb4341..ca1c72031 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicWatered.java +++ b/src/main/java/forestry/farming/logic/FarmLogicWatered.java @@ -15,9 +15,10 @@ import java.util.Collection; import java.util.List; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; @@ -97,7 +98,8 @@ public abstract class FarmLogicWatered extends FarmLogic { for (int i = 0; i < extent; i++) { Vect position = translateWithOffset(pos, direction, i); - Block soil = VectUtil.getBlock(world, position); + IBlockState state = world.getBlockState(position); + Block soil = state.getBlock(); ItemStack soilStack = VectUtil.getAsItemStack(world, position); if (isAcceptedGround(soilStack) || !housing.getFarmInventory().hasResources(resources)) { @@ -110,9 +112,9 @@ public abstract class FarmLogicWatered extends FarmLogic { break; } - if (!isAirBlock(soil) && !BlockUtil.isReplaceableBlock(soil)) { + if (!isAirBlock(soil, state, world, platformPosition) && !BlockUtil.isReplaceableBlock(state, world, platformPosition)) { produce.addAll(BlockUtil.getBlockDrops(getWorld(), position)); - setBlock(position, Blocks.air, 0); + world.setBlockToAir(position); return trySetSoil(position); } @@ -174,7 +176,7 @@ public abstract class FarmLogicWatered extends FarmLogic { } produce.addAll(BlockUtil.getBlockDrops(world, position)); - setBlock(position, Blocks.water, 0); + setBlock(position, Blocks.WATER, 0); housing.removeLiquid(STACK_WATER); return true; } diff --git a/src/main/java/forestry/farming/logic/FarmableBasicAgricraft.java b/src/main/java/forestry/farming/logic/FarmableBasicAgricraft.java index 2d3e37f1a..c0c95a4ee 100644 --- a/src/main/java/forestry/farming/logic/FarmableBasicAgricraft.java +++ b/src/main/java/forestry/farming/logic/FarmableBasicAgricraft.java @@ -13,7 +13,7 @@ package forestry.farming.logic; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.farming.ICrop; @@ -61,7 +61,7 @@ public class FarmableBasicAgricraft implements IFarmable { @Override public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { - return world.setBlockState(pos, block.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH); + return world.setBlockState(pos, block.getDefaultState(), Constants.FLAG_BLOCK_SYNCH); } } diff --git a/src/main/java/forestry/farming/logic/FarmableBasicFruit.java b/src/main/java/forestry/farming/logic/FarmableBasicFruit.java index 5fb814382..e8fcdb7b9 100644 --- a/src/main/java/forestry/farming/logic/FarmableBasicFruit.java +++ b/src/main/java/forestry/farming/logic/FarmableBasicFruit.java @@ -13,7 +13,7 @@ package forestry.farming.logic; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.farming.ICrop; @@ -56,7 +56,7 @@ public class FarmableBasicFruit implements IFarmable { @Override public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { - return world.setBlockState(pos, block.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH); + return world.setBlockState(pos, block.getDefaultState(), Constants.FLAG_BLOCK_SYNCH); } @Override diff --git a/src/main/java/forestry/farming/logic/FarmableBasicGrowthCraft.java b/src/main/java/forestry/farming/logic/FarmableBasicGrowthCraft.java index 664d4019f..4244c0dff 100644 --- a/src/main/java/forestry/farming/logic/FarmableBasicGrowthCraft.java +++ b/src/main/java/forestry/farming/logic/FarmableBasicGrowthCraft.java @@ -13,7 +13,7 @@ package forestry.farming.logic; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.farming.ICrop; @@ -60,7 +60,7 @@ public class FarmableBasicGrowthCraft implements IFarmable { @Override public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { - return world.setBlockState(pos, block.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH); + return world.setBlockState(pos, block.getDefaultState(), Constants.FLAG_BLOCK_SYNCH); } @Override diff --git a/src/main/java/forestry/farming/logic/FarmableBasicIC2Crop.java b/src/main/java/forestry/farming/logic/FarmableBasicIC2Crop.java index ef304f6de..dc7b916d5 100644 --- a/src/main/java/forestry/farming/logic/FarmableBasicIC2Crop.java +++ b/src/main/java/forestry/farming/logic/FarmableBasicIC2Crop.java @@ -3,7 +3,7 @@ package forestry.farming.logic; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.Optional; diff --git a/src/main/java/forestry/farming/logic/FarmableCocoa.java b/src/main/java/forestry/farming/logic/FarmableCocoa.java index 717a5d32d..23086b3f8 100755 --- a/src/main/java/forestry/farming/logic/FarmableCocoa.java +++ b/src/main/java/forestry/farming/logic/FarmableCocoa.java @@ -17,7 +17,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.farming.ICrop; diff --git a/src/main/java/forestry/farming/logic/FarmableGE.java b/src/main/java/forestry/farming/logic/FarmableGE.java index 1a0dff9cd..9a8d4a046 100755 --- a/src/main/java/forestry/farming/logic/FarmableGE.java +++ b/src/main/java/forestry/farming/logic/FarmableGE.java @@ -13,7 +13,7 @@ package forestry.farming.logic; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/farming/logic/FarmableGenericCrop.java b/src/main/java/forestry/farming/logic/FarmableGenericCrop.java index 8a8e4ffa0..0b784254a 100755 --- a/src/main/java/forestry/farming/logic/FarmableGenericCrop.java +++ b/src/main/java/forestry/farming/logic/FarmableGenericCrop.java @@ -13,7 +13,7 @@ package forestry.farming.logic; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/farming/logic/FarmableGenericSapling.java b/src/main/java/forestry/farming/logic/FarmableGenericSapling.java index 616e46714..a83247ca0 100755 --- a/src/main/java/forestry/farming/logic/FarmableGenericSapling.java +++ b/src/main/java/forestry/farming/logic/FarmableGenericSapling.java @@ -13,7 +13,7 @@ package forestry.farming.logic; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/farming/logic/FarmableGourd.java b/src/main/java/forestry/farming/logic/FarmableGourd.java index 16798a9e2..6b4e38463 100755 --- a/src/main/java/forestry/farming/logic/FarmableGourd.java +++ b/src/main/java/forestry/farming/logic/FarmableGourd.java @@ -12,7 +12,7 @@ package forestry.farming.logic; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.farming.ICrop; @@ -72,7 +72,7 @@ public class FarmableGourd implements IFarmable { @Override public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { - return world.setBlockState(pos, ItemStackUtil.getBlock(stem).getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH); + return world.setBlockState(pos, ItemStackUtil.getBlock(stem).getDefaultState(), Constants.FLAG_BLOCK_SYNCH); } } diff --git a/src/main/java/forestry/farming/logic/FarmableStacked.java b/src/main/java/forestry/farming/logic/FarmableStacked.java index ee0630aef..9d6c8e276 100755 --- a/src/main/java/forestry/farming/logic/FarmableStacked.java +++ b/src/main/java/forestry/farming/logic/FarmableStacked.java @@ -13,7 +13,7 @@ package forestry.farming.logic; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.farming.ICrop; @@ -55,7 +55,7 @@ public class FarmableStacked implements IFarmable { @Override public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) { - return world.setBlockState(pos, block.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH); + return world.setBlockState(pos, block.getDefaultState(), Constants.FLAG_BLOCK_SYNCH); } @Override diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java b/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java index 899b1600a..7289571e3 100644 --- a/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java +++ b/src/main/java/forestry/farming/logic/FarmableVanillaMushroom.java @@ -14,7 +14,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.farming.ICrop; @@ -54,7 +54,7 @@ public class FarmableVanillaMushroom extends FarmableGenericSapling { meta = 1; } - Proxies.common.addBlockPlaceEffects(world, pos, Blocks.brown_mushroom.getStateFromMeta(0)); + Proxies.common.addBlockPlaceEffects(world, pos, Blocks.brown_mushroom.getDefaultState()); return world.setBlockState(pos, PluginFarming.blocks.mushroom.getStateFromMeta(meta), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); } } diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java b/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java index 6a54e1eab..4cc135a32 100755 --- a/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java +++ b/src/main/java/forestry/farming/logic/FarmableVanillaSapling.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/farming/models/ModelFarmBlock.java b/src/main/java/forestry/farming/models/ModelFarmBlock.java index bf61f7157..0fd6578b3 100644 --- a/src/main/java/forestry/farming/models/ModelFarmBlock.java +++ b/src/main/java/forestry/farming/models/ModelFarmBlock.java @@ -4,7 +4,7 @@ import javax.annotation.Nonnull; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.property.IExtendedBlockState; diff --git a/src/main/java/forestry/farming/multiblock/FakeFarmController.java b/src/main/java/forestry/farming/multiblock/FakeFarmController.java index 9eb318b16..c3803180d 100644 --- a/src/main/java/forestry/farming/multiblock/FakeFarmController.java +++ b/src/main/java/forestry/farming/multiblock/FakeFarmController.java @@ -12,7 +12,7 @@ package forestry.farming.multiblock; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/forestry/farming/multiblock/FarmController.java b/src/main/java/forestry/farming/multiblock/FarmController.java index be1bb4240..040e15c03 100644 --- a/src/main/java/forestry/farming/multiblock/FarmController.java +++ b/src/main/java/forestry/farming/multiblock/FarmController.java @@ -10,6 +10,7 @@ ******************************************************************************/ package forestry.farming.multiblock; +import javax.annotation.Nonnull; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -27,7 +28,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -155,6 +156,7 @@ public class FarmController extends RectangularMultiblockControllerBase implemen return hydrationManager; } + @Nonnull @Override public IInventoryAdapter getInternalInventory() { if (isAssembled()) { diff --git a/src/main/java/forestry/farming/multiblock/FarmHydrationManager.java b/src/main/java/forestry/farming/multiblock/FarmHydrationManager.java index 8b8278d15..c6b40750b 100644 --- a/src/main/java/forestry/farming/multiblock/FarmHydrationManager.java +++ b/src/main/java/forestry/farming/multiblock/FarmHydrationManager.java @@ -14,7 +14,7 @@ import javax.annotation.Nonnull; import java.io.IOException; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.core.INbtReadable; import forestry.api.core.INbtWritable; diff --git a/src/main/java/forestry/farming/multiblock/InventoryFarm.java b/src/main/java/forestry/farming/multiblock/InventoryFarm.java index ec0626e97..757930bc5 100644 --- a/src/main/java/forestry/farming/multiblock/InventoryFarm.java +++ b/src/main/java/forestry/farming/multiblock/InventoryFarm.java @@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.Fluid; diff --git a/src/main/java/forestry/farming/proxy/ProxyFarmingClient.java b/src/main/java/forestry/farming/proxy/ProxyFarmingClient.java index 46a000b1b..a91fe1773 100644 --- a/src/main/java/forestry/farming/proxy/ProxyFarmingClient.java +++ b/src/main/java/forestry/farming/proxy/ProxyFarmingClient.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.farming.proxy; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import forestry.core.models.BlockModelIndex; import forestry.core.proxy.Proxies; diff --git a/src/main/java/forestry/farming/tiles/TileFarm.java b/src/main/java/forestry/farming/tiles/TileFarm.java index 2f0c7f449..82477e263 100644 --- a/src/main/java/forestry/farming/tiles/TileFarm.java +++ b/src/main/java/forestry/farming/tiles/TileFarm.java @@ -17,7 +17,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.circuits.ICircuitSocketType; import forestry.api.core.IErrorLogic; diff --git a/src/main/java/forestry/farming/tiles/TileFarmPlain.java b/src/main/java/forestry/farming/tiles/TileFarmPlain.java index f99d5b7b6..0fc282ea9 100644 --- a/src/main/java/forestry/farming/tiles/TileFarmPlain.java +++ b/src/main/java/forestry/farming/tiles/TileFarmPlain.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.farming.tiles; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import forestry.api.multiblock.IMultiblockController; @@ -31,6 +31,6 @@ public class TileFarmPlain extends TileFarm { super.onMachineBroken(); // set band block meta back to normal - this.worldObj.setBlockState(getPos(), getBlockType().getStateFromMeta(0), 2); + this.worldObj.setBlockState(getPos(), getBlockType().getDefaultState(), 2); } } diff --git a/src/main/java/forestry/greenhouse/GreenhouseHelper.java b/src/main/java/forestry/greenhouse/GreenhouseHelper.java index f14bbc36d..5e1b436eb 100644 --- a/src/main/java/forestry/greenhouse/GreenhouseHelper.java +++ b/src/main/java/forestry/greenhouse/GreenhouseHelper.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.greenhouse; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.greenhouse.IGreenhouseHelper; diff --git a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java index e8480a997..3b09db314 100644 --- a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java +++ b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouse.java @@ -19,18 +19,18 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -106,7 +106,7 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR } public BlockGreenhouse() { - super(Material.rock); + super(Material.ROCK); BlockGreenhouseType greenhouseType = getGreenhouseType(); IBlockState defaultState = this.blockState.getBaseState(); if (greenhouseType.activatable && greenhouseType != BlockGreenhouseType.SPRINKLER) { @@ -122,22 +122,22 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR setCreativeTab(CreativeTabForestry.tabForestry); } } - + @Override @SideOnly(Side.CLIENT) - public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) { + public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) { if (getGreenhouseType() == BlockGreenhouseType.SPRINKLER) { this.setBlockBoundsBasedOnState(worldIn, pos); } - return super.getSelectedBoundingBox(worldIn, pos); + return super.getSelectedBoundingBox(state, worldIn, pos); } @Override - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) { + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { if (getGreenhouseType() == BlockGreenhouseType.SPRINKLER) { this.setBlockBoundsBasedOnState(worldIn, pos); } - return super.getCollisionBoundingBox(worldIn, pos, state); + return super.getCollisionBoundingBox(blockState, worldIn, pos); } @Override @@ -164,7 +164,7 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR } @Override - protected BlockState createBlockState() { + protected BlockStateContainer createBlockState() { if (getGreenhouseType() == BlockGreenhouseType.SPRINKLER) { return new ExtendedBlockState(this, new IProperty[]{Properties.StaticProperty}, new IUnlistedProperty[]{Properties.AnimationProperty}); } else if (getGreenhouseType().activatable) { @@ -238,20 +238,20 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR /* MODELS */ @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() { + public BlockRenderLayer getBlockLayer() { if (getGreenhouseType() == BlockGreenhouseType.GLASS || getGreenhouseType() == BlockGreenhouseType.SPRINKLER) { - return EnumWorldBlockLayer.TRANSLUCENT; + return BlockRenderLayer.TRANSLUCENT; } - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } - + @Override - public boolean isFullCube() { + public boolean isFullCube(IBlockState state) { return getGreenhouseType() != BlockGreenhouseType.GLASS && getGreenhouseType() != BlockGreenhouseType.SPRINKLER; } - + @Override - public boolean isOpaqueCube() { + public boolean isOpaqueCube(IBlockState state) { return getGreenhouseType() != BlockGreenhouseType.GLASS && getGreenhouseType() != BlockGreenhouseType.SPRINKLER; } @@ -267,15 +267,15 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR } return super.canPlaceBlockAt(worldIn, pos); } - + @Override @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) { - IBlockState iblockstate = worldIn.getBlockState(pos); + public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { + IBlockState iblockstate = blockAccess.getBlockState(pos); Block block = iblockstate.getBlock(); if (getGreenhouseType() == BlockGreenhouseType.GLASS) { - if (worldIn.getBlockState(pos.offset(side.getOpposite())) != iblockstate) { + if (blockAccess.getBlockState(pos.offset(side.getOpposite())) != iblockstate) { return true; } @@ -283,10 +283,10 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR return false; } } else if (getGreenhouseType() == BlockGreenhouseType.DOOR) { - return super.shouldSideBeRendered(worldIn, pos, side); + return super.shouldSideBeRendered(blockState, blockAccess, pos, side); } - return block != this && super.shouldSideBeRendered(worldIn, pos, side); + return block != this && super.shouldSideBeRendered(blockState, blockAccess, pos, side); } @SideOnly(Side.CLIENT) @@ -306,7 +306,7 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR } @Override - public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) { + public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { return getGreenhouseType() == BlockGreenhouseType.CONTROL; } diff --git a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseDoor.java b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseDoor.java index d80fa47ae..945ca419f 100644 --- a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseDoor.java +++ b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseDoor.java @@ -18,19 +18,22 @@ import net.minecraft.block.BlockDoor; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.statemap.StateMap; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -63,7 +66,7 @@ public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapper } @Override - public boolean isOpaqueCube() { + public boolean isOpaqueCube(IBlockState state) { return false; } @@ -73,21 +76,20 @@ public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapper } @Override - public boolean isFullCube() { + public boolean isFullCube(IBlockState state) { return false; } @Override - @SideOnly(Side.CLIENT) - public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) { + public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) { this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getSelectedBoundingBox(worldIn, pos); + return super.getSelectedBoundingBox(state, worldIn, pos); } @Override - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) { + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getCollisionBoundingBox(worldIn, pos, state); + return super.getCollisionBoundingBox(blockState, worldIn, pos); } @Override @@ -140,25 +142,25 @@ public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapper } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { - TileEntity tile = world.getTileEntity(pos); + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { + TileEntity tile = worldIn.getTileEntity(pos); if (!(tile instanceof TileGreenhouseDoor)) { return false; } TileGreenhouseDoor door = (TileGreenhouseDoor) tile; - if (!door.getAccessHandler().allowsInteracting(player)) { + if (!door.getAccessHandler().allowsInteracting(playerIn)) { return false; } else { BlockPos blockpos = state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down(); - IBlockState iblockstate = pos.equals(blockpos) ? state : world.getBlockState(blockpos); + IBlockState iblockstate = pos.equals(blockpos) ? state : worldIn.getBlockState(blockpos); if (iblockstate.getBlock() != this) { return false; } else { state = iblockstate.cycleProperty(OPEN); - world.setBlockState(blockpos, state, 2); - world.markBlockRangeForRenderUpdate(blockpos, pos); - world.playAuxSFXAtEntity(player, state.getValue(OPEN) ? 1003 : 1006, pos, 0); + worldIn.setBlockState(blockpos, state, 2); + worldIn.markBlockRangeForRenderUpdate(blockpos, pos); + worldIn.playAuxSFXAtEntity(playerIn, state.getValue(OPEN) ? 1003 : 1006, pos, 0); return true; } } @@ -185,7 +187,7 @@ public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapper flag1 = true; } - if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down())) { + if (!worldIn.isSideSolid(pos.down(), EnumFacing.UP)) { worldIn.setBlockToAir(pos); flag1 = true; @@ -201,7 +203,7 @@ public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapper } else { boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(blockpos1); - if ((flag || neighborBlock.canProvidePower()) && neighborBlock != this && flag != iblockstate1.getValue(POWERED)) { + if ((flag || neighborBlock.canProvidePower(state)) && neighborBlock != this && flag != iblockstate1.getValue(POWERED)) { worldIn.setBlockState(blockpos1, iblockstate1.withProperty(POWERED, flag), 2); if (flag != state.getValue(OPEN)) { @@ -220,14 +222,14 @@ public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapper } @Override - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) { + public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) { this.setBlockBoundsBasedOnState(worldIn, pos); - return super.collisionRayTrace(worldIn, pos, start, end); + return super.collisionRayTrace(blockState, worldIn, pos, start, end); } @Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { - return pos.getY() < worldIn.getHeight() - 1 && (World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up())); + return pos.getY() < worldIn.getHeight() - 1 && (worldIn.isSideSolid(pos.down(), EnumFacing.UP)) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up())); } @Override @@ -285,8 +287,8 @@ public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapper @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() { - return EnumWorldBlockLayer.TRANSLUCENT; + public BlockRenderLayer getBlockLayer() { + return BlockRenderLayer.TRANSLUCENT; } @Override @@ -355,8 +357,8 @@ public class BlockGreenhouseDoor extends BlockGreenhouse implements IStateMapper } @Override - protected BlockState createBlockState() { - return new BlockState(this, HALF, FACING, OPEN, HINGE, POWERED); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, HALF, FACING, OPEN, HINGE, POWERED); } @Override diff --git a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseType.java b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseType.java index 10bc9185a..c04b28487 100644 --- a/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseType.java +++ b/src/main/java/forestry/greenhouse/blocks/BlockGreenhouseType.java @@ -8,7 +8,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; diff --git a/src/main/java/forestry/greenhouse/gui/widgets/WidgetCamouflageSlot.java b/src/main/java/forestry/greenhouse/gui/widgets/WidgetCamouflageSlot.java index d895398af..5a72616cf 100644 --- a/src/main/java/forestry/greenhouse/gui/widgets/WidgetCamouflageSlot.java +++ b/src/main/java/forestry/greenhouse/gui/widgets/WidgetCamouflageSlot.java @@ -13,13 +13,14 @@ package forestry.greenhouse.gui.widgets; import java.util.Locale; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.RenderItem; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import forestry.api.core.EnumCamouflageType; import forestry.api.core.ICamouflageHandler; @@ -46,7 +47,7 @@ public class WidgetCamouflageSlot extends Widget { @Override public void draw(int startX, int startY) { if (camouflageHandler != null && camouflageHandler.getCamouflageBlock(type) != null) { - Proxies.render.bindTexture(TextureMap.locationBlocksTexture); + Proxies.render.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); RenderItem renderItem = Proxies.common.getClientInstance().getRenderItem(); renderItem.renderItemIntoGUI(camouflageHandler.getCamouflageBlock(type), startX + xPos, startY + yPos); } @@ -65,9 +66,11 @@ public class WidgetCamouflageSlot extends Widget { ItemStack stack = player.inventory.getItemStack(); if (stack != null && Block.getBlockFromItem(stack.getItem()) != null) { Block block = Block.getBlockFromItem(stack.getItem()); - - if (!GreenhouseManager.greenhouseAccess.isOnCamouflageBlockBlackList(type, stack) && (type == EnumCamouflageType.DEFAULT && block.isOpaqueCube() && !block.hasTileEntity(block.getStateFromMeta(stack.getItemDamage())) && block.isNormalCube(player.worldObj, camouflageHandler.getCoordinates()) || type == EnumCamouflageType.GLASS && GreenhouseManager.greenhouseAccess.isGreenhouseGlass(stack))) { - camouflageHandler.setCamouflageBlock(type, stack); + if (!GreenhouseManager.greenhouseAccess.isOnCamouflageBlockBlackList(type, stack)) { + IBlockState stateFromMeta = block.getStateFromMeta(stack.getItemDamage()); + if (type == EnumCamouflageType.DEFAULT && block.isOpaqueCube(stateFromMeta) && !block.hasTileEntity(stateFromMeta) && block.isNormalCube(stateFromMeta, player.worldObj, camouflageHandler.getCoordinates()) || type == EnumCamouflageType.GLASS && GreenhouseManager.greenhouseAccess.isGreenhouseGlass(stack)) { + camouflageHandler.setCamouflageBlock(type, stack); + } } } } @@ -95,9 +98,9 @@ public class WidgetCamouflageSlot extends Widget { ItemStack camouflageBlock = camouflageHandler.getCamouflageBlock(type); if (camouflageHandler == null || camouflageBlock == null) { - toolTip.add(EnumChatFormatting.ITALIC.toString() + Translator.translateToLocal("for.gui.empty")); + toolTip.add(TextFormatting.ITALIC.toString() + Translator.translateToLocal("for.gui.empty")); } else { - toolTip.add(EnumChatFormatting.ITALIC.toString() + camouflageBlock.getTooltip(Proxies.common.getClientInstance().thePlayer, false)); + toolTip.add(TextFormatting.ITALIC.toString() + camouflageBlock.getTooltip(Proxies.common.getClientInstance().thePlayer, false)); } } }; diff --git a/src/main/java/forestry/greenhouse/items/ItemBlockGreenhouseDoor.java b/src/main/java/forestry/greenhouse/items/ItemBlockGreenhouseDoor.java index 6e94e840b..2dce08686 100644 --- a/src/main/java/forestry/greenhouse/items/ItemBlockGreenhouseDoor.java +++ b/src/main/java/forestry/greenhouse/items/ItemBlockGreenhouseDoor.java @@ -15,7 +15,7 @@ import net.minecraft.block.BlockDoor; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/greenhouse/models/ModelGreenhouse.java b/src/main/java/forestry/greenhouse/models/ModelGreenhouse.java index c268965af..5e7978900 100644 --- a/src/main/java/forestry/greenhouse/models/ModelGreenhouse.java +++ b/src/main/java/forestry/greenhouse/models/ModelGreenhouse.java @@ -18,7 +18,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockModelShapes; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; @@ -48,7 +48,7 @@ public class ModelGreenhouse extends ModelBlockOverlay { bakeBlockModel(block, world, pos, stateExtended, baker, camouflageStack); } - private void bakeBlockModel(@Nonnull BlockGreenhouse block, @Nullable IBlockAccess world, @Nullable BlockPos pos, @Nullable IExtendedBlockState stateExtended, @Nonnull IModelBaker baker, @Nullable ItemStack camouflageStack) { + private static void bakeBlockModel(@Nonnull BlockGreenhouse block, @Nullable IBlockAccess world, @Nullable BlockPos pos, @Nullable IExtendedBlockState stateExtended, @Nonnull IModelBaker baker, @Nullable ItemStack camouflageStack) { if (camouflageStack != null) { BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes(); @@ -68,6 +68,7 @@ public class ModelGreenhouse extends ModelBlockOverlay { baker.addBlockModel(block, pos, BlockGreenhouseType.getSprite(BlockGreenhouseType.PLAIN, null, null, world, pos), 100); baker.setParticleSprite(plainSprite); } + if (block.getGreenhouseType().hasOverlaySprite) { TextureAtlasSprite[] sprite = new TextureAtlasSprite[6]; for (EnumFacing facing : EnumFacing.VALUES) { diff --git a/src/main/java/forestry/greenhouse/multiblock/FakeGreenhouseController.java b/src/main/java/forestry/greenhouse/multiblock/FakeGreenhouseController.java index 7f16c8b79..a068e9668 100644 --- a/src/main/java/forestry/greenhouse/multiblock/FakeGreenhouseController.java +++ b/src/main/java/forestry/greenhouse/multiblock/FakeGreenhouseController.java @@ -15,7 +15,7 @@ import java.util.Collections; import java.util.List; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import forestry.api.core.EnumCamouflageType; import forestry.api.greenhouse.EnumGreenhouseEventType; diff --git a/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java b/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java index 946623c03..b223c5cfb 100644 --- a/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java +++ b/src/main/java/forestry/greenhouse/multiblock/GreenhouseController.java @@ -23,7 +23,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/forestry/greenhouse/multiblock/InternalBlock.java b/src/main/java/forestry/greenhouse/multiblock/InternalBlock.java index bb8acd284..792e0a79f 100644 --- a/src/main/java/forestry/greenhouse/multiblock/InternalBlock.java +++ b/src/main/java/forestry/greenhouse/multiblock/InternalBlock.java @@ -16,7 +16,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/greenhouse/multiblock/InternalBlockFace.java b/src/main/java/forestry/greenhouse/multiblock/InternalBlockFace.java index d831d2916..afc00feee 100644 --- a/src/main/java/forestry/greenhouse/multiblock/InternalBlockFace.java +++ b/src/main/java/forestry/greenhouse/multiblock/InternalBlockFace.java @@ -12,7 +12,7 @@ package forestry.greenhouse.multiblock; import javax.annotation.Nonnull; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import forestry.api.greenhouse.IInternalBlockFace; diff --git a/src/main/java/forestry/greenhouse/proxy/ProxyGreenhouseClient.java b/src/main/java/forestry/greenhouse/proxy/ProxyGreenhouseClient.java index 2e7083eaf..8bc9651ed 100644 --- a/src/main/java/forestry/greenhouse/proxy/ProxyGreenhouseClient.java +++ b/src/main/java/forestry/greenhouse/proxy/ProxyGreenhouseClient.java @@ -11,7 +11,7 @@ package forestry.greenhouse.proxy; import net.minecraft.block.Block; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraftforge.client.model.animation.AnimationTESR; import net.minecraftforge.fml.client.registry.ClientRegistry; diff --git a/src/main/java/forestry/greenhouse/tiles/TileGreenhouse.java b/src/main/java/forestry/greenhouse/tiles/TileGreenhouse.java index 871052ef9..3ea13076d 100644 --- a/src/main/java/forestry/greenhouse/tiles/TileGreenhouse.java +++ b/src/main/java/forestry/greenhouse/tiles/TileGreenhouse.java @@ -16,7 +16,7 @@ import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/forestry/greenhouse/tiles/TileGreenhouseDoor.java b/src/main/java/forestry/greenhouse/tiles/TileGreenhouseDoor.java index fef6517cd..5b65038a5 100644 --- a/src/main/java/forestry/greenhouse/tiles/TileGreenhouseDoor.java +++ b/src/main/java/forestry/greenhouse/tiles/TileGreenhouseDoor.java @@ -11,7 +11,7 @@ package forestry.greenhouse.tiles; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import forestry.api.core.IErrorLogic; import forestry.api.core.IErrorLogicSource; diff --git a/src/main/java/forestry/greenhouse/tiles/TileGreenhouseHatch.java b/src/main/java/forestry/greenhouse/tiles/TileGreenhouseHatch.java index d508c2e53..12a534570 100644 --- a/src/main/java/forestry/greenhouse/tiles/TileGreenhouseHatch.java +++ b/src/main/java/forestry/greenhouse/tiles/TileGreenhouseHatch.java @@ -18,7 +18,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import com.mojang.authlib.GameProfile; diff --git a/src/main/java/forestry/lepidopterology/ButterflySpawner.java b/src/main/java/forestry/lepidopterology/ButterflySpawner.java index 13b55400e..f930727a6 100755 --- a/src/main/java/forestry/lepidopterology/ButterflySpawner.java +++ b/src/main/java/forestry/lepidopterology/ButterflySpawner.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.lepidopterology; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import forestry.api.arboriculture.ILeafTickHandler; diff --git a/src/main/java/forestry/lepidopterology/blocks/BlockCocoon.java b/src/main/java/forestry/lepidopterology/blocks/BlockCocoon.java index eba1a7f7b..f22dbbee5 100644 --- a/src/main/java/forestry/lepidopterology/blocks/BlockCocoon.java +++ b/src/main/java/forestry/lepidopterology/blocks/BlockCocoon.java @@ -16,15 +16,16 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.SoundType; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -51,14 +52,14 @@ public class BlockCocoon extends Block implements ITileEntityProvider, IStateMap public BlockCocoon() { super(new MaterialCocoon()); setTickRandomly(true); - setStepSound(soundTypeGrass); + setSoundType(SoundType.GROUND); setCreativeTab(null); setDefaultState(this.blockState.getBaseState().withProperty(COCOON, AlleleButterflyCocoon.cocoonDefault).withProperty(AlleleButterflyCocoon.AGE, 0)); } @Override - protected BlockState createBlockState() { - return new BlockState(this, COCOON, AlleleButterflyCocoon.AGE); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, COCOON, AlleleButterflyCocoon.AGE); } @SideOnly(Side.CLIENT) @@ -83,16 +84,16 @@ public class BlockCocoon extends Block implements ITileEntityProvider, IStateMap //To delete the error message manager.registerItemModel(item, 0, "cocoon_late"); } - - @Override - public boolean isFullCube(){ - return false; - } - @Override - public boolean isOpaqueCube(){ - return false; - } + @Override + public boolean isFullBlock(IBlockState state) { + return false; + } + + @Override + public boolean isOpaqueCube(IBlockState state) { + return false; + } @Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { @@ -124,7 +125,7 @@ public class BlockCocoon extends Block implements ITileEntityProvider, IStateMap @Override public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) { IBlockState stateUp = worldIn.getBlockState(pos.up()); - if(stateUp.getBlock().isAir(worldIn, pos.up())){ + if(stateUp.getBlock().isAir(stateUp, worldIn, pos.up())){ worldIn.setBlockToAir(pos); } } @@ -135,7 +136,7 @@ public class BlockCocoon extends Block implements ITileEntityProvider, IStateMap } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) { + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileCocoon tile = TileUtil.getTile(world, pos, TileCocoon.class); if (tile == null) { return null; @@ -155,15 +156,15 @@ public class BlockCocoon extends Block implements ITileEntityProvider, IStateMap } @Override - public AxisAlignedBB getSelectedBoundingBox(World world, BlockPos pos) { - setBlockBounds(0.3125F, 0.3125F, 0.3125F, 0.6875F, 1F, 0.6875F); - return super.getSelectedBoundingBox(world, pos); - } - - @Override - public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) { - setBlockBounds(0.3125F, 0.3125F, 0.3125F, 0.6875F, 1F, 0.6875F); - return super.getCollisionBoundingBox(world, pos, state); - } + public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) { + setBlockBounds(0.3125F, 0.3125F, 0.3125F, 0.6875F, 1F, 0.6875F); + return super.getSelectedBoundingBox(state, worldIn, pos); + } + + @Override + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { + setBlockBounds(0.3125F, 0.3125F, 0.3125F, 0.6875F, 1F, 0.6875F); + return super.getCollisionBoundingBox(blockState, worldIn, pos); + } } diff --git a/src/main/java/forestry/lepidopterology/blocks/BlockSolidCocoon.java b/src/main/java/forestry/lepidopterology/blocks/BlockSolidCocoon.java index cba5acc96..acf3b8f5d 100644 --- a/src/main/java/forestry/lepidopterology/blocks/BlockSolidCocoon.java +++ b/src/main/java/forestry/lepidopterology/blocks/BlockSolidCocoon.java @@ -15,14 +15,15 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.SoundType; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -48,14 +49,14 @@ public class BlockSolidCocoon extends Block implements ITileEntityProvider, ISta setHarvestLevel("scoop", 0); setHardness(0.5F); setTickRandomly(true); - setStepSound(soundTypeGrass); + setSoundType(SoundType.GROUND); setCreativeTab(null); setDefaultState(this.blockState.getBaseState().withProperty(COCOON, AlleleButterflyCocoon.cocoonDefault).withProperty(AlleleButterflyCocoon.AGE, 0)); } @Override - protected BlockState createBlockState() { - return new BlockState(this, COCOON, AlleleButterflyCocoon.AGE); + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, COCOON, AlleleButterflyCocoon.AGE); } @SideOnly(Side.CLIENT) @@ -82,17 +83,17 @@ public class BlockSolidCocoon extends Block implements ITileEntityProvider, ISta } @Override - public boolean isFullCube(){ - return false; - } + public boolean isFullBlock(IBlockState state) { + return false; + } - @Override - public boolean isOpaqueCube(){ - return false; - } - @Override - public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { + public boolean isOpaqueCube(IBlockState state) { + return false; + } + + @Override + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { if (canHarvestBlock(world, pos, player)) { TileEntity tile = world.getTileEntity(pos); @@ -125,7 +126,7 @@ public class BlockSolidCocoon extends Block implements ITileEntityProvider, ISta @Override public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) { IBlockState stateUp = worldIn.getBlockState(pos.up()); - if(stateUp.getBlock().isAir(worldIn, pos.up())){ + if(stateUp.getBlock().isAir(stateUp, worldIn, pos.up())){ worldIn.setBlockToAir(pos); } } @@ -134,17 +135,17 @@ public class BlockSolidCocoon extends Block implements ITileEntityProvider, ISta public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { return Collections.emptyList(); } - - @Override - public AxisAlignedBB getSelectedBoundingBox(World world, BlockPos pos) { - setBlockBounds(0.3125F, 0.3125F, 0.3125F, 0.6875F, 1F, 0.6875F); - return super.getSelectedBoundingBox(world, pos); - } - - @Override - public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) { - setBlockBounds(0.3125F, 0.3125F, 0.3125F, 0.6875F, 1F, 0.6875F); - return super.getCollisionBoundingBox(world, pos, state); - } + + @Override + public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) { + setBlockBounds(0.3125F, 0.3125F, 0.3125F, 0.6875F, 1F, 0.6875F); + return super.getSelectedBoundingBox(state, worldIn, pos); + } + + @Override + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { + setBlockBounds(0.3125F, 0.3125F, 0.3125F, 0.6875F, 1F, 0.6875F); + return super.getCollisionBoundingBox(blockState, worldIn, pos); + } } diff --git a/src/main/java/forestry/lepidopterology/blocks/BlockTypeLepidopterologyTesr.java b/src/main/java/forestry/lepidopterology/blocks/BlockTypeLepidopterologyTesr.java index 8951f9b3d..791214286 100644 --- a/src/main/java/forestry/lepidopterology/blocks/BlockTypeLepidopterologyTesr.java +++ b/src/main/java/forestry/lepidopterology/blocks/BlockTypeLepidopterologyTesr.java @@ -14,7 +14,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import forestry.core.blocks.IBlockTypeTesr; import forestry.core.blocks.IMachinePropertiesTesr; diff --git a/src/main/java/forestry/lepidopterology/blocks/CocoonStateMapper.java b/src/main/java/forestry/lepidopterology/blocks/CocoonStateMapper.java index 13bb6cc98..a4ae3eba2 100644 --- a/src/main/java/forestry/lepidopterology/blocks/CocoonStateMapper.java +++ b/src/main/java/forestry/lepidopterology/blocks/CocoonStateMapper.java @@ -4,7 +4,7 @@ import java.util.Map; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java b/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java index 990938793..53e21fbbe 100755 --- a/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java +++ b/src/main/java/forestry/lepidopterology/entities/AIButterflyBase.java @@ -11,10 +11,11 @@ package forestry.lepidopterology.entities; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.RandomPositionGenerator; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; public abstract class AIButterflyBase extends EntityAIBase { @@ -24,13 +25,13 @@ public abstract class AIButterflyBase extends EntityAIBase { this.entity = entity; } - protected Vec3 getRandomDestination() { + protected Vec3d getRandomDestination() { if (entity.isInWater()) { return getRandomDestinationUpwards(); } - Vec3 randomTarget = RandomPositionGenerator.findRandomTargetBlockAwayFrom(entity, 16, 7, - new Vec3(entity.posX, entity.posY, entity.posZ)); + Vec3d randomTarget = RandomPositionGenerator.findRandomTargetBlockAwayFrom(entity, 16, 7, + new Vec3d(entity.posX, entity.posY, entity.posZ)); if (randomTarget == null) { return null; @@ -43,8 +44,8 @@ public abstract class AIButterflyBase extends EntityAIBase { } } - protected Vec3 getRandomDestinationUpwards() { - Vec3 destination = new Vec3(entity.posX, entity.posY + entity.getRNG().nextInt(10) + 2, entity.posZ); + protected Vec3d getRandomDestinationUpwards() { + Vec3d destination = new Vec3d(entity.posX, entity.posY + entity.getRNG().nextInt(10) + 2, entity.posZ); if (validateDestination(destination, true)) { return destination; } else { @@ -52,12 +53,13 @@ public abstract class AIButterflyBase extends EntityAIBase { } } - private boolean validateDestination(Vec3 dest, boolean allowFluids) { + private boolean validateDestination(Vec3d dest, boolean allowFluids) { if (dest.yCoord < 1) { return false; } - Block block = entity.worldObj.getBlockState(new BlockPos(dest)).getBlock(); - if (!allowFluids && block.getMaterial().isLiquid()) { + IBlockState blockState = entity.worldObj.getBlockState(new BlockPos(dest)); + Block block = blockState.getBlock(); + if (!allowFluids && block.getMaterial(blockState).isLiquid()) { return false; } if (!block.isPassable(entity.worldObj, new BlockPos(dest))) { diff --git a/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java b/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java index f594386b6..43747e251 100755 --- a/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java +++ b/src/main/java/forestry/lepidopterology/entities/AIButterflyInteract.java @@ -10,7 +10,7 @@ ******************************************************************************/ package forestry.lepidopterology.entities; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public abstract class AIButterflyInteract extends AIButterflyBase { diff --git a/src/main/java/forestry/lepidopterology/entities/AIButterflyMovement.java b/src/main/java/forestry/lepidopterology/entities/AIButterflyMovement.java index 99ce1ed9c..86ea2c1cc 100644 --- a/src/main/java/forestry/lepidopterology/entities/AIButterflyMovement.java +++ b/src/main/java/forestry/lepidopterology/entities/AIButterflyMovement.java @@ -10,14 +10,14 @@ ******************************************************************************/ package forestry.lepidopterology.entities; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; /** * @author CovertJaguar */ public abstract class AIButterflyMovement extends AIButterflyBase { - protected Vec3 flightTarget; + protected Vec3d flightTarget; protected AIButterflyMovement(EntityButterfly entity) { super(entity); diff --git a/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java b/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java index 310992507..72db1fe86 100755 --- a/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java +++ b/src/main/java/forestry/lepidopterology/entities/AIButterflyRest.java @@ -16,7 +16,7 @@ import net.minecraft.block.BlockFlower; import net.minecraft.block.BlockWall; import net.minecraft.block.IGrowable; import net.minecraft.block.material.Material; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.IPlantable; diff --git a/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java b/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java index c3f3472f5..b9de5e45f 100755 --- a/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java +++ b/src/main/java/forestry/lepidopterology/entities/EntityButterfly.java @@ -16,19 +16,21 @@ import net.minecraft.block.BlockFlower; import net.minecraft.block.BlockWall; import net.minecraft.block.IGrowable; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -53,7 +55,6 @@ import forestry.api.lepidopterology.IButterflyGenome; import forestry.api.lepidopterology.IButterflyRoot; import forestry.api.lepidopterology.IEntityButterfly; import forestry.api.lepidopterology.ILepidopteristTracker; -import forestry.core.utils.BlockUtil; import forestry.core.utils.ItemStackUtil; import forestry.lepidopterology.genetics.Butterfly; @@ -73,7 +74,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly public static final int EXHAUSTION_CONSUMPTION = 100 * EXHAUSTION_REST; public static final int MAX_LIFESPAN = 24000 * 7; // one minecraft week in ticks - private Vec3 flightTarget; + private Vec3d flightTarget; private int exhaustion; private IButterfly contained; private ITree pollen; @@ -187,11 +188,11 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly } /* DESTINATION */ - public Vec3 getDestination() { + public Vec3d getDestination() { return flightTarget; } - public void setDestination(Vec3 destination) { + public void setDestination(Vec3d destination) { flightTarget = destination; } @@ -203,7 +204,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly weight -= 15.0f; } - if (!worldObj.getEntitiesWithinAABB(EntityButterfly.class, AxisAlignedBB.fromBounds(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1)).isEmpty()) { + if (!worldObj.getEntitiesWithinAABB(EntityButterfly.class, new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1)).isEmpty()) { weight -= 1.0f; } @@ -211,23 +212,26 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly if (depth > 0) { weight -= 0.1f * depth; } else { - Block block = BlockUtil.getBlock(worldObj, pos); + IBlockState blockState = worldObj.getBlockState(pos); + Block block = blockState.getBlock(); if (block instanceof BlockFlower) { weight += 2.0f; } else if (block instanceof IPlantable) { weight += 1.5f; } else if (block instanceof IGrowable) { weight += 1.0f; - } else if (block.getMaterial() == Material.plants) { + } else if (block.getMaterial(blockState) == Material.PLANTS) { weight += 1.0f; } - block = BlockUtil.getBlock(worldObj, pos.add(0, -1, 0)); - if (block.isLeaves(worldObj, pos.add(0, -1, 0))) { + BlockPos posBelow = pos.down(); + IBlockState blockStateBelow = worldObj.getBlockState(posBelow); + Block blockBelow = blockState.getBlock(); + if (blockBelow.isLeaves(blockStateBelow, worldObj, posBelow)) { weight += 2.5f; - } else if (block instanceof BlockFence) { + } else if (blockBelow instanceof BlockFence) { weight += 1.0f; - } else if (block instanceof BlockWall) { + } else if (blockBelow instanceof BlockWall) { weight += 1.0f; } } @@ -242,10 +246,11 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly int zz = pos.getZ() & 15; int depth = 0; for (int y = chunk.getTopFilledSegment() + 15; y > 0; --y) { - Block block = chunk.getBlock(xx, y, zz); - if (block.getMaterial().isLiquid()) { + IBlockState blockState = chunk.getBlockState(xx, y, zz); + Block block = blockState.getBlock(); + if (block.getMaterial(blockState).isLiquid()) { depth++; - } else if (!block.isAir(worldObj, pos)) { + } else if (!block.isAir(blockState, worldObj, pos)) { break; } } @@ -364,8 +369,9 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly } /* INTERACTION */ + @Override - public boolean interact(EntityPlayer player) { + protected boolean processInteract(EntityPlayer player, EnumHand hand, ItemStack stack) { if (isDead) { return false; } @@ -388,7 +394,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly ItemStackUtil.dropItemStackAsEntity(itemStack, worldObj, posX, posY, posZ); setDead(); } else { - player.swingItem(); + player.swingArm(hand); } return true; } @@ -469,7 +475,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly motionZ += (Math.signum(diffZ) * 0.5d - motionZ) * 0.10000000149011612d; float horizontal = (float) (Math.atan2(motionZ, motionX) * 180d / Math.PI) - 90f; - rotationYaw += MathHelper.wrapAngleTo180_float(horizontal - rotationYaw); + rotationYaw += MathHelper.wrapDegrees(horizontal - rotationYaw); setMoveForward(contained.getGenome().getSpeed()); } @@ -483,9 +489,9 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly @Override public void fall(float distance, float damageMultiplier) { } - + @Override - protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) { + protected void updateFallState(double y, boolean onGroundIn, IBlockState state, BlockPos pos) { } @Override @@ -510,7 +516,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly } @Override - public ItemStack getPickedResult(MovingObjectPosition target) { + public ItemStack getPickedResult(RayTraceResult target) { if (species == null) { return null; } diff --git a/src/main/java/forestry/lepidopterology/genetics/Butterfly.java b/src/main/java/forestry/lepidopterology/genetics/Butterfly.java index 87d5e4de0..0f17a1938 100755 --- a/src/main/java/forestry/lepidopterology/genetics/Butterfly.java +++ b/src/main/java/forestry/lepidopterology/genetics/Butterfly.java @@ -21,8 +21,8 @@ import java.util.Random; import net.minecraft.entity.EntityCreature; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -87,26 +87,26 @@ public class Butterfly extends IndividualLiving implements IButterfly { IAlleleButterflySpecies primary = genome.getPrimary(); IAlleleButterflySpecies secondary = genome.getSecondary(); if (!isPureBred(EnumButterflyChromosome.SPECIES)) { - list.add(EnumChatFormatting.BLUE + Translator.translateToLocal("for.butterflies.hybrid").replaceAll("%PRIMARY", primary.getName()).replaceAll("%SECONDARY", secondary.getName())); + list.add(TextFormatting.BLUE + Translator.translateToLocal("for.butterflies.hybrid").replaceAll("%PRIMARY", primary.getName()).replaceAll("%SECONDARY", secondary.getName())); } if (getMate() != null) { - list.add(EnumChatFormatting.RED + Translator.translateToLocal("for.gui.fecundated").toUpperCase(Locale.ENGLISH)); + list.add(TextFormatting.RED + Translator.translateToLocal("for.gui.fecundated").toUpperCase(Locale.ENGLISH)); } - list.add(EnumChatFormatting.YELLOW + genome.getActiveAllele(EnumButterflyChromosome.SIZE).getName()); - list.add(EnumChatFormatting.DARK_GREEN + genome.getActiveAllele(EnumButterflyChromosome.SPEED).getName()); + list.add(TextFormatting.YELLOW + genome.getActiveAllele(EnumButterflyChromosome.SIZE).getName()); + list.add(TextFormatting.DARK_GREEN + genome.getActiveAllele(EnumButterflyChromosome.SPEED).getName()); list.add(genome.getActiveAllele(EnumButterflyChromosome.LIFESPAN).getName() + ' ' + Translator.translateToLocal("for.gui.life")); IAlleleTolerance tempTolerance = (IAlleleTolerance) getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE); - list.add(EnumChatFormatting.GREEN + "T: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / " + tempTolerance.getName()); + list.add(TextFormatting.GREEN + "T: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / " + tempTolerance.getName()); IAlleleTolerance humidTolerance = (IAlleleTolerance) getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE); - list.add(EnumChatFormatting.GREEN + "H: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / " + humidTolerance.getName()); + list.add(TextFormatting.GREEN + "H: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / " + humidTolerance.getName()); - list.add(EnumChatFormatting.RED + GenericRatings.rateActivityTime(genome.getNocturnal(), genome.getPrimary().isNocturnal())); + list.add(TextFormatting.RED + GenericRatings.rateActivityTime(genome.getNocturnal(), genome.getPrimary().isNocturnal())); if (genome.getTolerantFlyer()) { - list.add(EnumChatFormatting.WHITE + Translator.translateToLocal("for.gui.flyer.tooltip")); + list.add(TextFormatting.WHITE + Translator.translateToLocal("for.gui.flyer.tooltip")); } } diff --git a/src/main/java/forestry/lepidopterology/genetics/ButterflyRoot.java b/src/main/java/forestry/lepidopterology/genetics/ButterflyRoot.java index 62bcf7b48..7dabdeb6f 100644 --- a/src/main/java/forestry/lepidopterology/genetics/ButterflyRoot.java +++ b/src/main/java/forestry/lepidopterology/genetics/ButterflyRoot.java @@ -22,7 +22,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; diff --git a/src/main/java/forestry/lepidopterology/genetics/alleles/AlleleButterflyCocoon.java b/src/main/java/forestry/lepidopterology/genetics/alleles/AlleleButterflyCocoon.java index 071732be6..b9ee63e35 100644 --- a/src/main/java/forestry/lepidopterology/genetics/alleles/AlleleButterflyCocoon.java +++ b/src/main/java/forestry/lepidopterology/genetics/alleles/AlleleButterflyCocoon.java @@ -17,7 +17,7 @@ import java.util.List; import java.util.Map; import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemStack; import forestry.api.genetics.AlleleManager; diff --git a/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java b/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java index d22c9a590..650fedf0b 100755 --- a/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java +++ b/src/main/java/forestry/lepidopterology/items/ItemButterflyGE.java @@ -14,14 +14,14 @@ import java.util.List; import java.util.Random; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/forestry/lepidopterology/render/ModelButterfly.java b/src/main/java/forestry/lepidopterology/render/ModelButterfly.java index e57155d35..d5d2a3546 100755 --- a/src/main/java/forestry/lepidopterology/render/ModelButterfly.java +++ b/src/main/java/forestry/lepidopterology/render/ModelButterfly.java @@ -14,7 +14,7 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; public class ModelButterfly extends ModelBase { diff --git a/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java b/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java index 0c14aa762..36a5f67b3 100644 --- a/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java +++ b/src/main/java/forestry/lepidopterology/render/ModelButterflyItem.java @@ -18,7 +18,7 @@ import java.io.IOException; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.model.ModelRotation; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/forestry/lepidopterology/tiles/TileCocoon.java b/src/main/java/forestry/lepidopterology/tiles/TileCocoon.java index 5d25c873f..a6ae6a053 100644 --- a/src/main/java/forestry/lepidopterology/tiles/TileCocoon.java +++ b/src/main/java/forestry/lepidopterology/tiles/TileCocoon.java @@ -19,7 +19,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; diff --git a/src/main/java/forestry/lepidopterology/worldgen/CocoonDecorator.java b/src/main/java/forestry/lepidopterology/worldgen/CocoonDecorator.java index 98d62b093..a2b32baa7 100644 --- a/src/main/java/forestry/lepidopterology/worldgen/CocoonDecorator.java +++ b/src/main/java/forestry/lepidopterology/worldgen/CocoonDecorator.java @@ -18,7 +18,7 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.IChunkProvider; diff --git a/src/main/java/forestry/mail/Letter.java b/src/main/java/forestry/mail/Letter.java index 38aa9cbe4..8969ee901 100755 --- a/src/main/java/forestry/mail/Letter.java +++ b/src/main/java/forestry/mail/Letter.java @@ -19,7 +19,7 @@ import org.apache.commons.lang3.StringUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; import forestry.api.mail.ILetter; import forestry.api.mail.IMailAddress; @@ -338,7 +338,7 @@ public class Letter implements ILetter { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return inventory.getDisplayName(); } } diff --git a/src/main/java/forestry/mail/LetterProperties.java b/src/main/java/forestry/mail/LetterProperties.java index b599998ae..d4f678a87 100644 --- a/src/main/java/forestry/mail/LetterProperties.java +++ b/src/main/java/forestry/mail/LetterProperties.java @@ -14,7 +14,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/forestry/mail/POBox.java b/src/main/java/forestry/mail/POBox.java index 366d7bbb9..1d99d04ab 100755 --- a/src/main/java/forestry/mail/POBox.java +++ b/src/main/java/forestry/mail/POBox.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraft.world.WorldSavedData; import forestry.api.mail.ILetter; @@ -161,7 +161,7 @@ public class POBox extends WorldSavedData implements IInventory { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return letters.getDisplayName(); } diff --git a/src/main/java/forestry/mail/TradeStation.java b/src/main/java/forestry/mail/TradeStation.java index 6dbe8bc8a..b28b885c7 100755 --- a/src/main/java/forestry/mail/TradeStation.java +++ b/src/main/java/forestry/mail/TradeStation.java @@ -17,7 +17,7 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import net.minecraft.world.WorldSavedData; @@ -393,7 +393,7 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve private void removePaper() { for (int i = SLOT_LETTERS_1; i < SLOT_LETTERS_1 + SLOT_LETTERS_COUNT; i++) { ItemStack stack = inventory.getStackInSlot(i); - if (stack != null && stack.getItem() == Items.paper && stack.stackSize > 0) { + if (stack != null && stack.getItem() == Items.PAPER && stack.stackSize > 0) { inventory.decrStackSize(i, 1); break; } @@ -627,7 +627,7 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return inventory.getDisplayName(); } diff --git a/src/main/java/forestry/mail/commands/CommandMail.java b/src/main/java/forestry/mail/commands/CommandMail.java index 98851ec9d..9670e75ed 100644 --- a/src/main/java/forestry/mail/commands/CommandMail.java +++ b/src/main/java/forestry/mail/commands/CommandMail.java @@ -12,12 +12,13 @@ */ package forestry.mail.commands; +import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatStyle; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import forestry.api.mail.ITradeStation; @@ -48,7 +49,7 @@ public class CommandMail extends SubCommand { } @Override - public void processSubCommand(ICommandSender sender, String[] args) { + public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (!(sender instanceof EntityPlayer)) { return; } @@ -58,7 +59,7 @@ public class CommandMail extends SubCommand { } private static String makeTradeListEntry(ITradeStationInfo info) { - EnumChatFormatting formatting = info.getState().isOk() ? EnumChatFormatting.GREEN : EnumChatFormatting.RED; + TextFormatting formatting = info.getState().isOk() ? TextFormatting.GREEN : TextFormatting.RED; String tradegood = "[ ? ]"; if (info.getTradegood() != null) { @@ -85,24 +86,24 @@ public class CommandMail extends SubCommand { } @Override - public void processSubCommand(ICommandSender sender, String[] args) throws WrongUsageException { + public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length != 1) { CommandHelpers.throwWrongUsage(sender, this); } - World world = CommandHelpers.getWorld(sender, this); + World world = sender.getEntityWorld(); MailAddress address = new MailAddress(args[0]); ITradeStation trade = PostManager.postRegistry.getTradeStation(world, address); if (trade == null) { - ChatStyle red = new ChatStyle(); - red.setColor(EnumChatFormatting.RED); + Style red = new Style(); + red.setColor(TextFormatting.RED); CommandHelpers.sendLocalizedChatMessage(sender, red, "for.chat.command.forestry.mail.virtualize.no_tradestation", args[0]); return; } trade.setVirtual(!trade.isVirtual()); - ChatStyle green = new ChatStyle(); - green.setColor(EnumChatFormatting.GREEN); + Style green = new Style(); + green.setColor(TextFormatting.GREEN); CommandHelpers.sendLocalizedChatMessage(sender, green, "for.chat.command.forestry.mail.virtualize.set", trade.getAddress().getName(), trade.isVirtual()); } } diff --git a/src/main/java/forestry/mail/gui/GuiCatalogue.java b/src/main/java/forestry/mail/gui/GuiCatalogue.java index 636cfb734..063b883fd 100755 --- a/src/main/java/forestry/mail/gui/GuiCatalogue.java +++ b/src/main/java/forestry/mail/gui/GuiCatalogue.java @@ -17,7 +17,7 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraft.util.ResourceLocation; import org.lwjgl.input.Keyboard; @@ -32,7 +32,7 @@ import forestry.core.utils.Translator; public class GuiCatalogue extends GuiForestry { - private static final String boldUnderline = EnumChatFormatting.BOLD.toString() + EnumChatFormatting.UNDERLINE; + private static final String boldUnderline = TextFormatting.BOLD.toString() + TextFormatting.UNDERLINE; private GuiButton buttonFilter; private GuiButton buttonUse; @@ -109,9 +109,9 @@ public class GuiCatalogue extends GuiForestry { } if (tradeInfo.getState().isOk()) { - fontRendererObj.drawSplitString(EnumChatFormatting.DARK_GREEN + tradeInfo.getState().getDescription(), x, y + 82, 119, fontColor.get("gui.book")); + fontRendererObj.drawSplitString(TextFormatting.DARK_GREEN + tradeInfo.getState().getDescription(), x, y + 82, 119, fontColor.get("gui.book")); } else { - fontRendererObj.drawSplitString(EnumChatFormatting.DARK_RED + tradeInfo.getState().getDescription(), x, y + 82, 119, fontColor.get("gui.book")); + fontRendererObj.drawSplitString(TextFormatting.DARK_RED + tradeInfo.getState().getDescription(), x, y + 82, 119, fontColor.get("gui.book")); } } diff --git a/src/main/java/forestry/mail/gui/widgets/AddresseeSlot.java b/src/main/java/forestry/mail/gui/widgets/AddresseeSlot.java index 60e0c7978..36065ec44 100644 --- a/src/main/java/forestry/mail/gui/widgets/AddresseeSlot.java +++ b/src/main/java/forestry/mail/gui/widgets/AddresseeSlot.java @@ -38,7 +38,7 @@ public class AddresseeSlot extends Widget { IPostalCarrier carrier = PostManager.postRegistry.getCarrier(containerLetter.getCarrierType()); if (carrier != null) { GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0F); - Proxies.render.bindTexture(TextureMap.locationBlocksTexture); + Proxies.render.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos - 5, carrier.getSprite(), 26, 26); } } diff --git a/src/main/java/forestry/mail/items/ItemLetter.java b/src/main/java/forestry/mail/items/ItemLetter.java index 8e5004434..7dbf4a241 100755 --- a/src/main/java/forestry/mail/items/ItemLetter.java +++ b/src/main/java/forestry/mail/items/ItemLetter.java @@ -17,7 +17,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -44,7 +44,7 @@ public class ItemLetter extends ItemWithGui { if (itemstack.stackSize == 1) { openGui(entityplayer); } else { - entityplayer.addChatMessage(new ChatComponentTranslation("for.chat.mail.wrongstacksize")); + entityplayer.addChatMessage(new TextComponentTranslation("for.chat.mail.wrongstacksize")); } } diff --git a/src/main/java/forestry/mail/tiles/TileMailbox.java b/src/main/java/forestry/mail/tiles/TileMailbox.java index 748fff8ee..563a3368c 100644 --- a/src/main/java/forestry/mail/tiles/TileMailbox.java +++ b/src/main/java/forestry/mail/tiles/TileMailbox.java @@ -17,8 +17,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import com.mojang.authlib.GameProfile; @@ -51,23 +51,21 @@ public class TileMailbox extends TileBase implements IMailContainer { /* GUI */ @Override - public void openGui(EntityPlayer player) { + public void openGui(EntityPlayer player, ItemStack heldItem) { if (worldObj.isRemote) { return; } - ItemStack held = player.getCurrentEquippedItem(); - // Handle letter sending - if (PostManager.postRegistry.isLetter(held)) { - IPostalState result = this.tryDispatchLetter(held); + if (PostManager.postRegistry.isLetter(heldItem)) { + IPostalState result = this.tryDispatchLetter(heldItem); if (!result.isOk()) { - player.addChatMessage(new ChatComponentText(result.getDescription())); + player.addChatMessage(new TextComponentString(result.getDescription())); } else { - held.stackSize--; + heldItem.stackSize--; } } else { - super.openGui(player); + super.openGui(player, heldItem); } } diff --git a/src/main/java/forestry/plugins/BlankForestryPlugin.java b/src/main/java/forestry/plugins/BlankForestryPlugin.java index f38e90fc3..2c93c7d8d 100644 --- a/src/main/java/forestry/plugins/BlankForestryPlugin.java +++ b/src/main/java/forestry/plugins/BlankForestryPlugin.java @@ -20,6 +20,7 @@ import java.util.Set; import net.minecraft.command.ICommand; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.fml.common.IFuelHandler; @@ -101,7 +102,7 @@ public abstract class BlankForestryPlugin implements IForestryPlugin { } @Override - public void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGeneratedZ) { + public void populateChunk(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGeneratedZ) { } @Override diff --git a/src/main/java/forestry/plugins/IForestryPlugin.java b/src/main/java/forestry/plugins/IForestryPlugin.java index e50aa0510..d789f9a17 100644 --- a/src/main/java/forestry/plugins/IForestryPlugin.java +++ b/src/main/java/forestry/plugins/IForestryPlugin.java @@ -9,6 +9,7 @@ import java.util.Set; import net.minecraft.command.ICommand; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.fml.common.IFuelHandler; @@ -54,7 +55,7 @@ public interface IForestryPlugin { boolean processIMCMessage(FMLInterModComms.IMCMessage message); - void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGeneratedZ); + void populateChunk(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGeneratedZ); void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ); diff --git a/src/main/java/forestry/plugins/PluginManager.java b/src/main/java/forestry/plugins/PluginManager.java index 3e565ed03..d6a0ddf7a 100644 --- a/src/main/java/forestry/plugins/PluginManager.java +++ b/src/main/java/forestry/plugins/PluginManager.java @@ -30,6 +30,7 @@ import net.minecraft.command.ICommand; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.common.config.Configuration; @@ -285,7 +286,7 @@ public class PluginManager { } } - public static void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { + public static void populateChunk(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) { for (IForestryPlugin plugin : loadedPlugins) { plugin.populateChunk(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated); } diff --git a/src/main/java/forestry/storage/items/ItemBackpack.java b/src/main/java/forestry/storage/items/ItemBackpack.java index 83df40424..d48f20488 100755 --- a/src/main/java/forestry/storage/items/ItemBackpack.java +++ b/src/main/java/forestry/storage/items/ItemBackpack.java @@ -14,13 +14,13 @@ import java.util.List; import java.util.Locale; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World;