Fix more errors
This commit is contained in:
@@ -12,6 +12,7 @@ import com.raoulvdberge.refinedstorage.tile.TileBase;
|
||||
import com.raoulvdberge.refinedstorage.util.CollisionUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.WorldUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -192,7 +193,7 @@ public abstract class BlockBase extends Block {
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<CollisionGroup> getCollisions(TileEntity tile, IBlockState state) {
|
||||
public List<CollisionGroup> getCollisions(TileEntity tile, BlockState state) {
|
||||
return DEFAULT_COLLISION_GROUPS;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.raoulvdberge.refinedstorage.capability;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
@@ -26,12 +26,12 @@ public class CapabilityNetworkNodeProxy {
|
||||
private static class Storage implements Capability.IStorage<INetworkNodeProxy> {
|
||||
@Nullable
|
||||
@Override
|
||||
public NBTBase writeNBT(Capability<INetworkNodeProxy> capability, INetworkNodeProxy instance, EnumFacing side) {
|
||||
public INBT writeNBT(Capability<INetworkNodeProxy> capability, INetworkNodeProxy instance, Direction side) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(Capability<INetworkNodeProxy> capability, INetworkNodeProxy instance, EnumFacing side, NBTBase nbt) {
|
||||
public void readNBT(Capability<INetworkNodeProxy> capability, INetworkNodeProxy instance, Direction side, INBT nbt) {
|
||||
// NO OP
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.command;
|
||||
|
||||
/* TODO
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDisk;
|
||||
import com.raoulvdberge.refinedstorage.api.storage.disk.IStorageDiskProvider;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
@@ -21,7 +22,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CommandCreateDisk extends CommandBase {
|
||||
public class CommandCreateDisk extends Command {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "createdisk";
|
||||
@@ -88,3 +89,4 @@ public class CommandCreateDisk extends CommandBase {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -11,12 +11,10 @@ import com.raoulvdberge.refinedstorage.container.transfer.TransferManager;
|
||||
import com.raoulvdberge.refinedstorage.network.MessageSlotFilterFluidUpdate;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileBase;
|
||||
import com.raoulvdberge.refinedstorage.tile.data.TileDataWatcher;
|
||||
import invtweaks.api.container.InventoryContainer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.ClickType;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@@ -24,7 +22,6 @@ import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@InventoryContainer(showOptions = false)
|
||||
public abstract class ContainerBase extends Container {
|
||||
@Nullable
|
||||
private TileBase tile;
|
||||
@@ -37,7 +34,9 @@ public abstract class ContainerBase extends Container {
|
||||
private List<SlotFilterFluid> fluidSlots = new ArrayList<>();
|
||||
private List<FluidStack> fluids = new ArrayList<>();
|
||||
|
||||
public ContainerBase(@Nullable TileBase tile, PlayerEntity player) {
|
||||
public ContainerBase(@Nullable TileBase tile, PlayerEntity player, int windowId) {
|
||||
super(ContainerType.CRAFTING, windowId);
|
||||
|
||||
this.tile = tile;
|
||||
|
||||
if (tile != null && player instanceof ServerPlayerEntity) {
|
||||
|
||||
@@ -48,8 +48,8 @@ public class FluidInventory {
|
||||
}
|
||||
|
||||
public void setFluid(int slot, @Nullable FluidStack stack) {
|
||||
if (stack != null && stack.amount <= 0 && stack.amount > maxAmount) {
|
||||
throw new IllegalArgumentException("Fluid size is invalid (given: " + stack.amount + ", max size: " + maxAmount + ")");
|
||||
if (stack != null && stack.getAmount() <= 0 && stack.getAmount() > maxAmount) {
|
||||
throw new IllegalArgumentException("Fluid size is invalid (given: " + stack.getAmount() + ", max size: " + maxAmount + ")");
|
||||
}
|
||||
|
||||
fluids[slot] = stack;
|
||||
@@ -79,7 +79,7 @@ public class FluidInventory {
|
||||
for (int i = 0; i < getSlots(); ++i) {
|
||||
String key = String.format(NBT_SLOT, i);
|
||||
|
||||
if (tag.hasKey(key)) {
|
||||
if (tag.contains(key)) {
|
||||
fluids[i] = FluidStack.loadFluidStackFromNBT(tag.getCompound(key));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,15 +11,15 @@ public class FluidInventoryFilter extends FluidInventory {
|
||||
super(27, Integer.MAX_VALUE, null);
|
||||
|
||||
this.listener = slot -> {
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.setTagCompound(new CompoundNBT());
|
||||
if (!stack.hasTag()) {
|
||||
stack.setTag(new CompoundNBT());
|
||||
}
|
||||
|
||||
stack.getTagCompound().put(ItemFilter.NBT_FLUID_FILTERS, writeToNbt());
|
||||
stack.getTag().put(ItemFilter.NBT_FLUID_FILTERS, writeToNbt());
|
||||
};
|
||||
|
||||
if (stack.hasTagCompound() && stack.getTagCompound().hasKey(ItemFilter.NBT_FLUID_FILTERS)) {
|
||||
readFromNbt(stack.getTagCompound().getCompound(ItemFilter.NBT_FLUID_FILTERS));
|
||||
if (stack.hasTag() && stack.getTag().contains(ItemFilter.NBT_FLUID_FILTERS)) {
|
||||
readFromNbt(stack.getTag().getCompound(ItemFilter.NBT_FLUID_FILTERS));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ public class FluidInventoryFilterIcon extends FluidInventory {
|
||||
super(1, Integer.MAX_VALUE, null);
|
||||
|
||||
this.listener = slot -> {
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.setTagCompound(new CompoundNBT());
|
||||
if (!stack.hasTag()) {
|
||||
stack.setTag(new CompoundNBT());
|
||||
}
|
||||
|
||||
ItemFilter.setFluidIcon(stack, getFluid(slot));
|
||||
|
||||
@@ -13,8 +13,8 @@ import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidatorBas
|
||||
import com.raoulvdberge.refinedstorage.item.ItemFilter;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.common.thread.EffectiveSide;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -47,7 +47,7 @@ public class ItemHandlerFilter extends ItemHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
if (EffectiveSide.get() == LogicalSide.CLIENT) { // TODO check
|
||||
GuiBase.executeLater(GuiGrid.class, grid -> grid.getView().sort());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ public class ItemHandlerFilterItems extends ItemStackHandler {
|
||||
|
||||
this.stack = stack;
|
||||
|
||||
if (stack.hasTagCompound()) {
|
||||
StackUtils.readItems(this, 0, stack.getTagCompound());
|
||||
if (stack.hasTag()) {
|
||||
StackUtils.readItems(this, 0, stack.getTag());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ public class ItemHandlerFilterItems extends ItemStackHandler {
|
||||
protected void onContentsChanged(int slot) {
|
||||
super.onContentsChanged(slot);
|
||||
|
||||
if (!stack.hasTagCompound()) {
|
||||
stack.setTagCompound(new CompoundNBT());
|
||||
if (!stack.hasTag()) {
|
||||
stack.setTag(new CompoundNBT());
|
||||
}
|
||||
|
||||
StackUtils.writeItems(this, 0, stack.getTagCompound());
|
||||
StackUtils.writeItems(this, 0, stack.getTag());
|
||||
}
|
||||
|
||||
public NonNullList<ItemStack> getFilteredItems() {
|
||||
|
||||
@@ -41,4 +41,9 @@ public class ItemHandlerProxy implements IItemHandler {
|
||||
public int getSlotLimit(int slot) {
|
||||
return slot < insertHandler.getSlots() ? insertHandler.getSlotLimit(slot) : extractHandler.getSlotLimit(slot - insertHandler.getSlots());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(int slot, @Nonnull ItemStack stack) {
|
||||
return slot < insertHandler.getSlots() ? insertHandler.isItemValid(slot, stack) : extractHandler.isItemValid(slot - extractHandler.getSlots(), stack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.raoulvdberge.refinedstorage.inventory.item;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.inventory.item.validator.ItemValidatorBasic;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemUpgrade;
|
||||
|
||||
@@ -8,11 +7,11 @@ import javax.annotation.Nullable;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ItemHandlerUpgrade extends ItemHandlerBase {
|
||||
public ItemHandlerUpgrade(int size, @Nullable Consumer<Integer> listener, int... supportedUpgrades) {
|
||||
public ItemHandlerUpgrade(int size, @Nullable Consumer<Integer> listener, ItemUpgrade... supportedUpgrades) {
|
||||
super(size, listener, new ItemValidatorBasic[supportedUpgrades.length]);
|
||||
|
||||
for (int i = 0; i < supportedUpgrades.length; ++i) {
|
||||
this.validators[i] = new ItemValidatorBasic(RSItems.UPGRADE, supportedUpgrades[i]);
|
||||
this.validators[i] = new ItemValidatorBasic(supportedUpgrades[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +21,8 @@ public class ItemHandlerUpgrade extends ItemHandlerBase {
|
||||
|
||||
public int getSpeed(int speed, int speedIncrease) {
|
||||
for (int i = 0; i < getSlots(); ++i) {
|
||||
if (!getStackInSlot(i).isEmpty() && getStackInSlot(i).getItemDamage() == ItemUpgrade.TYPE_SPEED) {
|
||||
/*TODO if (!getStackInSlot(i).isEmpty() && getStackInSlot(i).getItemDamage() == ItemUpgrade.TYPE_SPEED) {*/
|
||||
if (false) {
|
||||
speed -= speedIncrease;
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,8 @@ public class ItemHandlerUpgrade extends ItemHandlerBase {
|
||||
int upgrades = 0;
|
||||
|
||||
for (int i = 0; i < getSlots(); ++i) {
|
||||
if (!getStackInSlot(i).isEmpty() && getStackInSlot(i).getItemDamage() == type) {
|
||||
/*TODO if (!getStackInSlot(i).isEmpty() && getStackInSlot(i).getItemDamage() == type) {*/
|
||||
if (false) {
|
||||
upgrades++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,13 @@ import java.util.function.Predicate;
|
||||
|
||||
public class ItemValidatorBasic implements Predicate<ItemStack> {
|
||||
private Item item;
|
||||
private int damage = -1;
|
||||
|
||||
public ItemValidatorBasic(Item item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
public ItemValidatorBasic(Item item, int damage) {
|
||||
this.item = item;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(ItemStack stack) {
|
||||
return stack.getItem() == item && !(damage != -1 && stack.getItemDamage() != damage);
|
||||
return stack.getItem() == item;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
package com.raoulvdberge.refinedstorage.recipe;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.cover.CoverManager;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemCover;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
public class RecipeCover extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
|
||||
public class RecipeCover implements IRecipe<CraftingInventory> {
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World world) {
|
||||
public boolean matches(CraftingInventory inv, World world) {
|
||||
boolean hadCuttingTool = false;
|
||||
boolean hadItem = false;
|
||||
|
||||
@@ -44,7 +47,7 @@ public class RecipeCover extends IForgeRegistryEntry.Impl<IRecipe> implements IR
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
public ItemStack getCraftingResult(CraftingInventory inv) {
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
ItemStack slot = inv.getStackInSlot(i);
|
||||
|
||||
@@ -69,4 +72,19 @@ public class RecipeCover extends IForgeRegistryEntry.Impl<IRecipe> implements IR
|
||||
public ItemStack getRecipeOutput() {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return new ResourceLocation(RS.ID, "cover");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeType<?> getType() {
|
||||
return IRecipeType.CRAFTING;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
package com.raoulvdberge.refinedstorage.recipe;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.network.node.cover.CoverManager;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemCover;
|
||||
import com.raoulvdberge.refinedstorage.item.ItemHollowCover;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RecipeHollowCover extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
|
||||
public class RecipeHollowCover implements IRecipe<CraftingInventory> {
|
||||
protected boolean isValid(ItemStack slot, @Nullable ItemStack previousValidSlot) {
|
||||
ItemStack currentCover = ItemCover.getItem(slot);
|
||||
|
||||
@@ -23,14 +26,14 @@ public class RecipeHollowCover extends IForgeRegistryEntry.Impl<IRecipe> impleme
|
||||
|
||||
ItemStack previousCover = ItemCover.getItem(previousValidSlot);
|
||||
|
||||
return previousCover.getItem() == currentCover.getItem() && previousCover.getItemDamage() == currentCover.getItemDamage();
|
||||
return previousCover.getItem() == currentCover.getItem();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World worldIn) {
|
||||
public boolean matches(CraftingInventory inv, World worldIn) {
|
||||
ItemStack previousValidSlot = null;
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
@@ -53,7 +56,7 @@ public class RecipeHollowCover extends IForgeRegistryEntry.Impl<IRecipe> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
public ItemStack getCraftingResult(CraftingInventory inv) {
|
||||
ItemStack stack = new ItemStack(RSItems.HOLLOW_COVER, 8);
|
||||
|
||||
ItemHollowCover.setItem(stack, ItemCover.getItem(inv.getStackInSlot(0)));
|
||||
@@ -70,4 +73,19 @@ public class RecipeHollowCover extends IForgeRegistryEntry.Impl<IRecipe> impleme
|
||||
public ItemStack getRecipeOutput() {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return new ResourceLocation(RS.ID, "hollow_cover");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeSerializer<?> getSerializer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeType<?> getType() {
|
||||
return IRecipeType.CRAFTING;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,36 @@
|
||||
package com.raoulvdberge.refinedstorage.recipe;
|
||||
/*
|
||||
|
||||
TODO
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentData;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.EnchantedBookItem;
|
||||
import net.minecraft.item.ItemEnchantedBook;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.item.crafting.ShapedRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// MC JSON recipes don't like comparing to NBT, that's why we need a custom recipe class.
|
||||
// We need to compare to NBT for the enchanted book.
|
||||
public class RecipeUpgradeWithEnchantedBook extends ShapedRecipes {
|
||||
public class RecipeUpgradeWithEnchantedBook extends ShapedRecipe {
|
||||
private EnchantmentData enchant;
|
||||
|
||||
public RecipeUpgradeWithEnchantedBook(String enchantmentId, int enchantmentLevel, int upgradeId) {
|
||||
super(RS.ID, 3, 3, NonNullList.from(Ingredient.EMPTY,
|
||||
Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)),
|
||||
Ingredient.fromStacks(ItemEnchantedBook.getEnchantedItemStack(new EnchantmentData(Enchantment.getEnchantmentByLocation(enchantmentId), enchantmentLevel))),
|
||||
Ingredient.fromStacks(EnchantedBookItem.getEnchantedItemStack(new EnchantmentData(Registry.ENCHANTMENT.getOrDefault(new ResourceLocation("minecraft", enchantmentId)), enchantmentLevel))),
|
||||
Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)),
|
||||
Ingredient.fromStacks(new ItemStack(Blocks.BOOKSHELF)),
|
||||
Ingredient.fromStacks(new ItemStack(RSItems.UPGRADE)),
|
||||
@@ -31,7 +38,7 @@ public class RecipeUpgradeWithEnchantedBook extends ShapedRecipes {
|
||||
Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)),
|
||||
Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON)),
|
||||
Ingredient.fromStacks(new ItemStack(RSItems.QUARTZ_ENRICHED_IRON))
|
||||
), new ItemStack(RSItems.UPGRADE, 1, upgradeId));
|
||||
), new ItemStack(RSItems.UPGRADE, 1));
|
||||
|
||||
this.enchant = new EnchantmentData(Enchantment.getEnchantmentByLocation(enchantmentId), enchantmentLevel);
|
||||
}
|
||||
@@ -54,3 +61,4 @@ public class RecipeUpgradeWithEnchantedBook extends ShapedRecipes {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.raoulvdberge.refinedstorage.render;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
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.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -32,23 +32,23 @@ public class CubeBuilder {
|
||||
}
|
||||
|
||||
public static class Face {
|
||||
private EnumFacing face;
|
||||
private Direction face;
|
||||
private TextureAtlasSprite sprite;
|
||||
private int light;
|
||||
private UvRotation uvRotation = UvRotation.CLOCKWISE_0;
|
||||
|
||||
public Face(EnumFacing face, TextureAtlasSprite sprite) {
|
||||
public Face(Direction face, TextureAtlasSprite sprite) {
|
||||
this.face = face;
|
||||
this.sprite = sprite;
|
||||
}
|
||||
|
||||
public Face(EnumFacing face, TextureAtlasSprite sprite, UvRotation uvRotation) {
|
||||
public Face(Direction face, TextureAtlasSprite sprite, UvRotation uvRotation) {
|
||||
this(face, sprite);
|
||||
|
||||
this.uvRotation = uvRotation;
|
||||
}
|
||||
|
||||
public Face(EnumFacing face, TextureAtlasSprite sprite, UvRotation uvRotation, int light) {
|
||||
public Face(Direction face, TextureAtlasSprite sprite, UvRotation uvRotation, int light) {
|
||||
this(face, sprite, uvRotation);
|
||||
|
||||
this.light = light;
|
||||
@@ -58,7 +58,7 @@ public class CubeBuilder {
|
||||
private Vector3f from;
|
||||
private Vector3f to;
|
||||
private VertexFormat format = DefaultVertexFormats.ITEM;
|
||||
private Map<EnumFacing, Face> faces = new HashMap<>();
|
||||
private Map<Direction, Face> faces = new HashMap<>();
|
||||
private int color = 0xFFFFFFFF;
|
||||
|
||||
public CubeBuilder from(float x, float y, float z) {
|
||||
@@ -85,8 +85,8 @@ public class CubeBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CubeBuilder addFaces(Function<EnumFacing, Face> faceSupplier) {
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
public CubeBuilder addFaces(Function<Direction, Face> faceSupplier) {
|
||||
for (Direction facing : Direction.values()) {
|
||||
addFace(faceSupplier.apply(facing));
|
||||
}
|
||||
|
||||
@@ -102,14 +102,14 @@ public class CubeBuilder {
|
||||
public List<BakedQuad> bake() {
|
||||
List<BakedQuad> quads = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<EnumFacing, Face> entry : faces.entrySet()) {
|
||||
for (Map.Entry<Direction, Face> entry : faces.entrySet()) {
|
||||
quads.add(bakeFace(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
||||
return quads;
|
||||
}
|
||||
|
||||
private BakedQuad bakeFace(EnumFacing facing, Face cubeFace) {
|
||||
private BakedQuad bakeFace(Direction facing, Face cubeFace) {
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
|
||||
|
||||
builder.setTexture(cubeFace.sprite);
|
||||
@@ -117,51 +117,51 @@ public class CubeBuilder {
|
||||
builder.setQuadTint(-1);
|
||||
builder.setApplyDiffuseLighting(true);
|
||||
|
||||
Uv uv = getDefaultUv(facing, cubeFace.sprite, from.x, from.y, from.z, to.x, to.y, to.z);
|
||||
Uv uv = getDefaultUv(facing, cubeFace.sprite, from.getX(), from.getY(), from.getZ(), to.getX(), to.getY(), to.getZ());
|
||||
|
||||
switch (facing) {
|
||||
case DOWN:
|
||||
addVertexTopRight(builder, cubeFace, to.x, from.y, from.z, uv);
|
||||
addVertexBottomRight(builder, cubeFace, to.x, from.y, to.z, uv);
|
||||
addVertexBottomLeft(builder, cubeFace, from.x, from.y, to.z, uv);
|
||||
addVertexTopLeft(builder, cubeFace, from.x, from.y, from.z, uv);
|
||||
addVertexTopRight(builder, cubeFace, to.getX(), from.getY(), from.getZ(), uv);
|
||||
addVertexBottomRight(builder, cubeFace, to.getX(), from.getY(), to.getZ(), uv);
|
||||
addVertexBottomLeft(builder, cubeFace, from.getX(), from.getY(), to.getZ(), uv);
|
||||
addVertexTopLeft(builder, cubeFace, from.getX(), from.getY(), from.getZ(), uv);
|
||||
break;
|
||||
case UP:
|
||||
addVertexTopLeft(builder, cubeFace, from.x, to.y, from.z, uv);
|
||||
addVertexBottomLeft(builder, cubeFace, from.x, to.y, to.z, uv);
|
||||
addVertexBottomRight(builder, cubeFace, to.x, to.y, to.z, uv);
|
||||
addVertexTopRight(builder, cubeFace, to.x, to.y, from.z, uv);
|
||||
addVertexTopLeft(builder, cubeFace, from.getX(), to.getY(), from.getZ(), uv);
|
||||
addVertexBottomLeft(builder, cubeFace, from.getX(), to.getY(), to.getZ(), uv);
|
||||
addVertexBottomRight(builder, cubeFace, to.getX(), to.getY(), to.getZ(), uv);
|
||||
addVertexTopRight(builder, cubeFace, to.getX(), to.getY(), from.getZ(), uv);
|
||||
break;
|
||||
case NORTH:
|
||||
addVertexBottomRight(builder, cubeFace, to.x, to.y, from.z, uv);
|
||||
addVertexTopRight(builder, cubeFace, to.x, from.y, from.z, uv);
|
||||
addVertexTopLeft(builder, cubeFace, from.x, from.y, from.z, uv);
|
||||
addVertexBottomLeft(builder, cubeFace, from.x, to.y, from.z, uv);
|
||||
addVertexBottomRight(builder, cubeFace, to.getX(), to.getY(), from.getZ(), uv);
|
||||
addVertexTopRight(builder, cubeFace, to.getX(), from.getY(), from.getZ(), uv);
|
||||
addVertexTopLeft(builder, cubeFace, from.getX(), from.getY(), from.getZ(), uv);
|
||||
addVertexBottomLeft(builder, cubeFace, from.getX(), to.getY(), from.getZ(), uv);
|
||||
break;
|
||||
case SOUTH:
|
||||
addVertexBottomLeft(builder, cubeFace, from.x, to.y, to.z, uv);
|
||||
addVertexTopLeft(builder, cubeFace, from.x, from.y, to.z, uv);
|
||||
addVertexTopRight(builder, cubeFace, to.x, from.y, to.z, uv);
|
||||
addVertexBottomRight(builder, cubeFace, to.x, to.y, to.z, uv);
|
||||
addVertexBottomLeft(builder, cubeFace, from.getX(), to.getY(), to.getZ(), uv);
|
||||
addVertexTopLeft(builder, cubeFace, from.getX(), from.getY(), to.getZ(), uv);
|
||||
addVertexTopRight(builder, cubeFace, to.getX(), from.getY(), to.getZ(), uv);
|
||||
addVertexBottomRight(builder, cubeFace, to.getX(), to.getY(), to.getZ(), uv);
|
||||
break;
|
||||
case WEST:
|
||||
addVertexTopLeft(builder, cubeFace, from.x, from.y, from.z, uv);
|
||||
addVertexTopRight(builder, cubeFace, from.x, from.y, to.z, uv);
|
||||
addVertexBottomRight(builder, cubeFace, from.x, to.y, to.z, uv);
|
||||
addVertexBottomLeft(builder, cubeFace, from.x, to.y, from.z, uv);
|
||||
addVertexTopLeft(builder, cubeFace, from.getX(), from.getY(), from.getZ(), uv);
|
||||
addVertexTopRight(builder, cubeFace, from.getX(), from.getY(), to.getZ(), uv);
|
||||
addVertexBottomRight(builder, cubeFace, from.getX(), to.getY(), to.getZ(), uv);
|
||||
addVertexBottomLeft(builder, cubeFace, from.getX(), to.getY(), from.getZ(), uv);
|
||||
break;
|
||||
case EAST:
|
||||
addVertexBottomRight(builder, cubeFace, to.x, to.y, from.z, uv);
|
||||
addVertexBottomLeft(builder, cubeFace, to.x, to.y, to.z, uv);
|
||||
addVertexTopLeft(builder, cubeFace, to.x, from.y, to.z, uv);
|
||||
addVertexTopRight(builder, cubeFace, to.x, from.y, from.z, uv);
|
||||
addVertexBottomRight(builder, cubeFace, to.getX(), to.getY(), from.getZ(), uv);
|
||||
addVertexBottomLeft(builder, cubeFace, to.getX(), to.getY(), to.getZ(), uv);
|
||||
addVertexTopLeft(builder, cubeFace, to.getX(), from.getY(), to.getZ(), uv);
|
||||
addVertexTopRight(builder, cubeFace, to.getX(), from.getY(), from.getZ(), uv);
|
||||
break;
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private Uv getDefaultUv(EnumFacing face, TextureAtlasSprite texture, float fromX, float fromY, float fromZ, float toX, float toY, float toZ) {
|
||||
private Uv getDefaultUv(Direction face, TextureAtlasSprite texture, float fromX, float fromY, float fromZ, float toX, float toY, float toZ) {
|
||||
Uv uv = new Uv();
|
||||
|
||||
switch (face) {
|
||||
|
||||
@@ -20,7 +20,7 @@ public class AdvancedRayTraceResult<T extends RayTraceResult> {
|
||||
}
|
||||
|
||||
public double squareDistanceTo(Vec3d vec) {
|
||||
return hit.hitVec.squareDistanceTo(vec);
|
||||
return hit.getHitVec().squareDistanceTo(vec);
|
||||
}
|
||||
|
||||
public CollisionGroup getGroup() {
|
||||
|
||||
@@ -16,7 +16,7 @@ public final class AdvancedRayTracer {
|
||||
}
|
||||
|
||||
public static Vec3d getEnd(PlayerEntity player) {
|
||||
double reachDistance = player instanceof ServerPlayerEntity ? player.getEntityAttribute(PlayerEntity.REACH_DISTANCE).getAttributeValue() : (player.capabilities.isCreativeMode ? 5.0D : 4.5D);
|
||||
double reachDistance = player instanceof ServerPlayerEntity ? player.getAttribute(PlayerEntity.REACH_DISTANCE).getValue() : (player.isCreative() ? 5.0D : 4.5D);
|
||||
|
||||
Vec3d lookVec = player.getLookVec();
|
||||
Vec3d start = getStart(player);
|
||||
@@ -51,13 +51,12 @@ public final class AdvancedRayTracer {
|
||||
}
|
||||
|
||||
public static AdvancedRayTraceResult<RayTraceResult> rayTrace(BlockPos pos, Vec3d start, Vec3d end, AxisAlignedBB bounds, int subHit, CollisionGroup group) {
|
||||
RayTraceResult result = bounds.offset(pos).calculateIntercept(start, end);
|
||||
RayTraceResult result = AxisAlignedBB.rayTrace(group.getItems(), start, end, pos); // TODO: Correct?
|
||||
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
result = new RayTraceResult(RayTraceResult.Type.BLOCK, result.hitVec, result.sideHit, pos);
|
||||
result.subHit = subHit;
|
||||
|
||||
return new AdvancedRayTraceResult<>(group, bounds, result);
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
package com.raoulvdberge.refinedstorage.render.collision;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.raoulvdberge.refinedstorage.block.BlockBase;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
public class BlockHighlightListener {
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onBlockDrawHighlight(DrawBlockHighlightEvent e) {
|
||||
if (e.getTarget() == null || e.getTarget().getBlockPos() == null) {
|
||||
if (e.getTarget() == null || e.getInfo().getBlockPos() == null) { // TODO: Still need to check this?
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerEntity player = e.getPlayer();
|
||||
PlayerEntity player = (PlayerEntity) e.getInfo().getRenderViewEntity();
|
||||
|
||||
BlockPos pos = e.getTarget().getBlockPos();
|
||||
BlockPos pos = e.getInfo().getBlockPos();
|
||||
|
||||
Block b = player.getEntityWorld().getBlockState(pos).getBlock();
|
||||
|
||||
@@ -33,7 +33,8 @@ public class BlockHighlightListener {
|
||||
|
||||
BlockBase block = (BlockBase) b;
|
||||
|
||||
IBlockState state = block.getActualState(block.getDefaultState(), player.getEntityWorld(), pos);
|
||||
// TODO BlockState state = block.getActualState(block.getDefaultState(), player.getEntityWorld(), pos);
|
||||
BlockState state = e.getInfo().getBlockAtCamera();
|
||||
|
||||
AdvancedRayTraceResult result = AdvancedRayTracer.rayTrace(
|
||||
pos,
|
||||
@@ -49,10 +50,10 @@ public class BlockHighlightListener {
|
||||
}
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.color(0.0F, 0.0F, 0.0F, 0.4F);
|
||||
GlStateManager.glLineWidth(3.0F);
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.blendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.color4f(0.0F, 0.0F, 0.0F, 0.4F);
|
||||
GlStateManager.lineWidth(3.0F);
|
||||
GlStateManager.disableTexture();
|
||||
GlStateManager.depthMask(false);
|
||||
|
||||
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) e.getPartialTicks();
|
||||
@@ -64,7 +65,7 @@ public class BlockHighlightListener {
|
||||
}
|
||||
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.enableTexture();
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemColorPattern implements IItemColor {
|
||||
@Override
|
||||
public int colorMultiplier(ItemStack stack, int tintIndex) {
|
||||
CraftingPattern pattern = ItemPattern.getPatternFromCache(Minecraft.getMinecraft().world, stack);
|
||||
public int getColor(ItemStack stack, int tintIndex) {
|
||||
CraftingPattern pattern = ItemPattern.getPatternFromCache(Minecraft.getInstance().world, stack);
|
||||
|
||||
if (BakedModelPattern.canDisplayOutput(stack, pattern)) {
|
||||
int color = Minecraft.getMinecraft().getItemColors().colorMultiplier(pattern.getOutputs().get(0), tintIndex);
|
||||
int color = Minecraft.getInstance().getItemColors().getColor(pattern.getOutputs().get(0), tintIndex);
|
||||
|
||||
if (color != -1) {
|
||||
return color;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.raoulvdberge.refinedstorage.render.constants;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup;
|
||||
import com.raoulvdberge.refinedstorage.util.CollisionUtils;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -16,15 +16,15 @@ public final class ConstantsCable {
|
||||
public static final CollisionGroup UP = new CollisionGroup().addItem(CollisionUtils.getBounds(6, 10, 6, 10, 16, 10));
|
||||
public static final CollisionGroup DOWN = new CollisionGroup().addItem(CollisionUtils.getBounds(6, 0, 6, 10, 6, 10));
|
||||
|
||||
public static final CollisionGroup HOLDER_NORTH = new CollisionGroup().addItem(getHolderBounds(EnumFacing.NORTH));
|
||||
public static final CollisionGroup HOLDER_EAST = new CollisionGroup().addItem(getHolderBounds(EnumFacing.EAST));
|
||||
public static final CollisionGroup HOLDER_SOUTH = new CollisionGroup().addItem(getHolderBounds(EnumFacing.SOUTH));
|
||||
public static final CollisionGroup HOLDER_WEST = new CollisionGroup().addItem(getHolderBounds(EnumFacing.WEST));
|
||||
public static final CollisionGroup HOLDER_UP = new CollisionGroup().addItem(getHolderBounds(EnumFacing.UP));
|
||||
public static final CollisionGroup HOLDER_DOWN = new CollisionGroup().addItem(getHolderBounds(EnumFacing.DOWN));
|
||||
public static final CollisionGroup HOLDER_NORTH = new CollisionGroup().addItem(getHolderBounds(Direction.NORTH));
|
||||
public static final CollisionGroup HOLDER_EAST = new CollisionGroup().addItem(getHolderBounds(Direction.EAST));
|
||||
public static final CollisionGroup HOLDER_SOUTH = new CollisionGroup().addItem(getHolderBounds(Direction.SOUTH));
|
||||
public static final CollisionGroup HOLDER_WEST = new CollisionGroup().addItem(getHolderBounds(Direction.WEST));
|
||||
public static final CollisionGroup HOLDER_UP = new CollisionGroup().addItem(getHolderBounds(Direction.UP));
|
||||
public static final CollisionGroup HOLDER_DOWN = new CollisionGroup().addItem(getHolderBounds(Direction.DOWN));
|
||||
|
||||
@Nonnull
|
||||
public static AxisAlignedBB getCoverBounds(EnumFacing side) {
|
||||
public static AxisAlignedBB getCoverBounds(Direction side) {
|
||||
switch (side) {
|
||||
case DOWN:
|
||||
return CollisionUtils.getBounds(0, 0, 0, 16, 2, 16);
|
||||
@@ -44,7 +44,7 @@ public final class ConstantsCable {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static AxisAlignedBB getHolderBounds(EnumFacing side) {
|
||||
public static AxisAlignedBB getHolderBounds(Direction side) {
|
||||
switch (side) {
|
||||
case DOWN:
|
||||
return CollisionUtils.getBounds(7, 2, 7, 9, 6, 9);
|
||||
|
||||
@@ -9,11 +9,13 @@ import com.raoulvdberge.refinedstorage.block.BlockCable;
|
||||
import com.raoulvdberge.refinedstorage.render.CubeBuilder;
|
||||
import com.raoulvdberge.refinedstorage.render.constants.ConstantsCable;
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
@@ -31,7 +33,7 @@ public class BakedModelCableCover extends BakedModelDelegate {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, long rand) {
|
||||
List<BakedQuad> quads = new ArrayList<>(base.getQuads(state, side, rand));
|
||||
|
||||
if (state != null) {
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package com.raoulvdberge.refinedstorage.render.tesr;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileStorageMonitor;
|
||||
import com.sun.prism.TextureMap;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntitySpecialRendererStorageMonitor extends TileEntitySpecialRenderer<TileStorageMonitor> {
|
||||
public class TileEntitySpecialRendererStorageMonitor extends TileEntityRenderer<TileStorageMonitor> {
|
||||
@Override
|
||||
public void render(TileStorageMonitor tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
|
||||
public void render(TileStorageMonitor tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
setLightmapDisabled(true);
|
||||
|
||||
float disX = 0, disXText = 0;
|
||||
@@ -39,7 +39,7 @@ public class TileEntitySpecialRendererStorageMonitor extends TileEntitySpecialRe
|
||||
}
|
||||
}
|
||||
|
||||
if (tile.getDirection() == EnumFacing.NORTH) {
|
||||
if (tile.getDirection() == Direction.NORTH) {
|
||||
disX = 0.5F;
|
||||
disXText = disX + textWidth;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class TileEntitySpecialRendererStorageMonitor extends TileEntitySpecialRe
|
||||
disZText = disZ - spacing;
|
||||
|
||||
rotZ = 1F;
|
||||
} else if (tile.getDirection() == EnumFacing.WEST) {
|
||||
} else if (tile.getDirection() == Direction.WEST) {
|
||||
disX = -spacing;
|
||||
disXText = disX - spacing;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class TileEntitySpecialRendererStorageMonitor extends TileEntitySpecialRe
|
||||
|
||||
rotZ = 1F;
|
||||
rotX = 1F;
|
||||
} else if (tile.getDirection() == EnumFacing.SOUTH) {
|
||||
} else if (tile.getDirection() == Direction.SOUTH) {
|
||||
disX = 0.5F;
|
||||
disXText = disX - textWidth;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class TileEntitySpecialRendererStorageMonitor extends TileEntitySpecialRe
|
||||
disZText = disZ + spacing;
|
||||
|
||||
rotX = 1F;
|
||||
} else if (tile.getDirection() == EnumFacing.EAST) {
|
||||
} else if (tile.getDirection() == Direction.EAST) {
|
||||
disX = 1F + spacing;
|
||||
disXText = disX + spacing;
|
||||
|
||||
@@ -76,49 +76,50 @@ public class TileEntitySpecialRendererStorageMonitor extends TileEntitySpecialRe
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(x + disX, y + disY, z + disZ);
|
||||
GlStateManager.rotate(180F, rotX, rotY, rotZ);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.translated(x + disX, y + disY, z + disZ);
|
||||
GlStateManager.rotated(180F, rotX, rotY, rotZ);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
GlStateManager.depthMask(false);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.scale(0.4F, -0.4F, -0.015F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
|
||||
GlStateManager.scalef(0.4F, -0.4F, -0.015F);
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getInstance().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
|
||||
if (tile.getItemStack() != null) {
|
||||
IBakedModel bakedModel = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(tile.getItemStack(), null, Minecraft.getMinecraft().player);
|
||||
IBakedModel bakedModel = Minecraft.getInstance().getItemRenderer().getItemModelWithOverrides(tile.getItemStack(), null, Minecraft.getInstance().player);
|
||||
bakedModel = ForgeHooksClient.handleCameraTransforms(bakedModel, ItemCameraTransforms.TransformType.GUI, false);
|
||||
Minecraft.getMinecraft().getRenderItem().renderItem(tile.getItemStack(), bakedModel);
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(tile.getItemStack(), bakedModel);
|
||||
}
|
||||
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.disableLighting();
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Minecraft.getInstance().getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.translate(x + disXText, y + disYText, z + disZText);
|
||||
GlStateManager.rotate(180F, rotX, rotY, rotZ);
|
||||
GlStateManager.translated(x + disXText, y + disYText, z + disZText);
|
||||
GlStateManager.rotated(180F, rotX, rotY, rotZ);
|
||||
float size = 0.00450F;
|
||||
float factor = 2.0f;
|
||||
GlStateManager.scale(size * factor, size * factor, size);
|
||||
GlStateManager.scaled(size * factor, size * factor, size);
|
||||
|
||||
if (tile.getItemStack() != null) {
|
||||
Minecraft.getMinecraft().fontRenderer.drawString(amount, 0, 0, 0xFFFFFF);
|
||||
Minecraft.getInstance().fontRenderer.drawString(amount, 0, 0, 0xFFFFFF);
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -33,7 +34,7 @@ public abstract class TileBase extends TileEntity {
|
||||
markDirty();
|
||||
}
|
||||
|
||||
public EnumFacing getDirection() {
|
||||
public Direction getDirection() {
|
||||
return world.isRemote ? clientDirection : directionHandler.getDirection();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public final class AccessTypeUtils {
|
||||
}
|
||||
|
||||
public static AccessType readAccessType(CompoundNBT tag) {
|
||||
return tag.hasKey(NBT_ACCESS_TYPE) ? getAccessType(tag.getInteger(NBT_ACCESS_TYPE)) : AccessType.INSERT_EXTRACT;
|
||||
return tag.contains(NBT_ACCESS_TYPE) ? getAccessType(tag.getInt(NBT_ACCESS_TYPE)) : AccessType.INSERT_EXTRACT;
|
||||
}
|
||||
|
||||
public static AccessType getAccessType(int id) {
|
||||
|
||||
@@ -1,38 +1,36 @@
|
||||
package com.raoulvdberge.refinedstorage.util;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IComparer;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
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.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.MissingTextureSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.client.event.RenderTooltipEvent;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -40,10 +38,11 @@ import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Vector3f;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public final class RenderUtils {
|
||||
public static final Matrix4f EMPTY_MATRIX_TRANSFORM = getTransform(0, 0, 0, 0, 0, 0, 1.0f).getMatrix();
|
||||
public static final Matrix4f EMPTY_MATRIX_TRANSFORM = getTransform(0, 0, 0, 0, 0, 0, 1.0f).getMatrix(Direction.DOWN); // TODO: dir?
|
||||
|
||||
// @Volatile: From ForgeBlockStateV1
|
||||
private static final TRSRTransformation FLIP_X = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null);
|
||||
@@ -65,7 +64,7 @@ public final class RenderUtils {
|
||||
float green = (color >> 8 & 0xFF) / 255.0F;
|
||||
float blue = (color & 0xFF) / 255.0F;
|
||||
|
||||
GlStateManager.color(red, green, blue, 1.0F);
|
||||
GlStateManager.color4f(red, green, blue, 1.0F);
|
||||
}
|
||||
|
||||
private static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
|
||||
@@ -156,14 +155,14 @@ public final class RenderUtils {
|
||||
|
||||
public void draw(Minecraft minecraft, int xPosition, int yPosition, FluidStack fluidStack) {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableAlphaTest();
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
drawFluid(minecraft, xPosition, yPosition, fluidStack);
|
||||
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableAlphaTest();
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
@@ -178,6 +177,7 @@ public final class RenderUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO
|
||||
TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
|
||||
ResourceLocation fluidStill = fluid.getStill();
|
||||
TextureAtlasSprite fluidStillSprite = null;
|
||||
@@ -231,6 +231,7 @@ public final class RenderUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +242,7 @@ public final class RenderUtils {
|
||||
if (!stacks.get(i).isEmpty() && !combinedIndices.contains(i)) {
|
||||
ItemStack stack = stacks.get(i);
|
||||
|
||||
String data = stack.getDisplayName();
|
||||
String data = stack.getDisplayName().getString(); // TODO does this work
|
||||
|
||||
int amount = stack.getCount();
|
||||
|
||||
@@ -267,13 +268,13 @@ public final class RenderUtils {
|
||||
if (!combinedIndices.contains(i)) {
|
||||
FluidStack stack = stacks.get(i);
|
||||
|
||||
String data = stack.getLocalizedName();
|
||||
String data = stack.getDisplayName().getString(); // TODO does this work
|
||||
|
||||
int amount = stack.amount;
|
||||
int amount = stack.getAmount();
|
||||
|
||||
for (int j = i + 1; j < stacks.size(); ++j) {
|
||||
if (API.instance().getComparer().isEqual(stack, stacks.get(j), IComparer.COMPARE_NBT)) {
|
||||
amount += stacks.get(j).amount;
|
||||
amount += stacks.get(j).getAmount();
|
||||
|
||||
combinedIndices.add(j);
|
||||
}
|
||||
@@ -301,13 +302,14 @@ public final class RenderUtils {
|
||||
FontRenderer font = event.getFontRenderer();
|
||||
|
||||
// RS BEGIN
|
||||
float textScale = font.getUnicodeFlag() ? 1F : 0.7F;
|
||||
//float textScale = font.getUnicodeFlag() ? 1F : 0.7F;
|
||||
float textScale = 1F;
|
||||
// RS END
|
||||
|
||||
GlStateManager.disableRescaleNormal();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.disableDepthTest();
|
||||
int tooltipTextWidth = 0;
|
||||
|
||||
for (String textLine : textLines) {
|
||||
@@ -388,7 +390,7 @@ public final class RenderUtils {
|
||||
// RS BEGIN
|
||||
if (showSmallText) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scale(textScale, textScale, 1);
|
||||
GlStateManager.scalef(textScale, textScale, 1);
|
||||
|
||||
int y = tooltipTop + tooltipHeight - 6;
|
||||
|
||||
@@ -396,7 +398,7 @@ public final class RenderUtils {
|
||||
font.drawStringWithShadow(
|
||||
TextFormatting.GRAY + smallTextLines.get(i),
|
||||
RenderUtils.getOffsetOnScale(tooltipX, textScale),
|
||||
RenderUtils.getOffsetOnScale(y - (font.getUnicodeFlag() ? 2 : 0), textScale),
|
||||
RenderUtils.getOffsetOnScale(y - (/* TODO font.getUnicodeFlag() ? 2 : */0), textScale),
|
||||
-1
|
||||
);
|
||||
|
||||
@@ -408,21 +410,22 @@ public final class RenderUtils {
|
||||
// RS END
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableDepthTest();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
}
|
||||
}
|
||||
|
||||
// @Volatile: From GuiScreen#getItemToolTip
|
||||
public static List<String> getItemTooltip(ItemStack stack) {
|
||||
List<String> lines = stack.getTooltip(Minecraft.getMinecraft().player, Minecraft.getMinecraft().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
|
||||
public static List<ITextComponent> getItemTooltip(ItemStack stack) {
|
||||
// TODO
|
||||
List<ITextComponent> lines = stack.getTooltip(Minecraft.getInstance().player, Minecraft.getInstance().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
|
||||
|
||||
for (int i = 0; i < lines.size(); ++i) {
|
||||
if (i == 0) {
|
||||
lines.set(i, stack.getItem().getForgeRarity(stack).getColor() + lines.get(i));
|
||||
//lines.set(i, stack.getItem().getRarity(stack).color + lines.get(i));
|
||||
} else {
|
||||
lines.set(i, TextFormatting.GRAY + lines.get(i));
|
||||
//lines.set(i, TextFormatting.GRAY + lines.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,7 +433,8 @@ public final class RenderUtils {
|
||||
}
|
||||
|
||||
public static boolean isLightMapDisabled() {
|
||||
return FMLClientHandler.instance().hasOptifine() || !ForgeModContainer.forgeLightPipelineEnabled;
|
||||
return false;
|
||||
// TODO return FMLClientHandler.instance().hasOptifine() || !ForgeModContainer.forgeLightPipelineEnabled;
|
||||
}
|
||||
|
||||
public static VertexFormat getFormatWithLightMap(VertexFormat format) {
|
||||
@@ -442,7 +446,7 @@ public final class RenderUtils {
|
||||
return DefaultVertexFormats.BLOCK;
|
||||
} else if (format == DefaultVertexFormats.ITEM) {
|
||||
return ITEM_FORMAT_WITH_LIGHTMAP;
|
||||
} else if (!format.hasUvOffset(1)) {
|
||||
} else if (!format.hasUv(1)) {
|
||||
VertexFormat result = new VertexFormat(format);
|
||||
|
||||
result.addElement(DefaultVertexFormats.TEX_2S);
|
||||
@@ -453,7 +457,7 @@ public final class RenderUtils {
|
||||
return format;
|
||||
}
|
||||
|
||||
public static TextureAtlasSprite getSprite(IBakedModel coverModel, IBlockState coverState, EnumFacing facing, long rand) {
|
||||
public static TextureAtlasSprite getSprite(IBakedModel coverModel, BlockState coverState, Direction facing, long rand) {
|
||||
TextureAtlasSprite sprite = null;
|
||||
|
||||
BlockRenderLayer originalLayer = MinecraftForgeClient.getRenderLayer();
|
||||
@@ -462,11 +466,11 @@ public final class RenderUtils {
|
||||
for (BlockRenderLayer layer : BlockRenderLayer.values()) {
|
||||
ForgeHooksClient.setRenderLayer(layer);
|
||||
|
||||
for (BakedQuad bakedQuad : coverModel.getQuads(coverState, facing, rand)) {
|
||||
for (BakedQuad bakedQuad : coverModel.getQuads(coverState, facing, new Random())) {
|
||||
return bakedQuad.getSprite();
|
||||
}
|
||||
|
||||
for (BakedQuad bakedQuad : coverModel.getQuads(coverState, null, rand)) {
|
||||
for (BakedQuad bakedQuad : coverModel.getQuads(coverState, null, new Random())) { // TODO random inst
|
||||
if (sprite == null) {
|
||||
sprite = bakedQuad.getSprite();
|
||||
}
|
||||
@@ -491,9 +495,9 @@ public final class RenderUtils {
|
||||
}
|
||||
|
||||
if (sprite == null) {
|
||||
sprite = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
|
||||
sprite = MissingTextureSprite.func_217790_a(); // TODO Mapping
|
||||
}
|
||||
|
||||
return sprite;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user