Re-Activated the facade recipe and item model

This commit is contained in:
Sebastian Hartte
2020-06-21 23:35:57 +02:00
parent 00e794f03f
commit 094ee93dbc
11 changed files with 50 additions and 131 deletions
@@ -1,35 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.items.parts;
import appeng.bootstrap.IItemRendering;
import appeng.bootstrap.ItemRenderingCustomizer;
/**
* Handles rendering customization for facade items. Please note that this works
* very differently from actually rendering a Facade in a cable bus.
*/
public class FacadeRendering extends ItemRenderingCustomizer {
@Override
public void customize(IItemRendering rendering) {
// This actually just uses the path it will look for by default, no custom model
// redirection needed
// FIXME rendering.builtInModel( "models/item/facade", new FacadeItemModel() );
}
}
@@ -27,12 +27,9 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.item.Items;
import net.minecraft.item.*;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
@@ -58,7 +55,6 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
public ItemFacade(Properties properties) {
super(properties);
// FIXME this.setHasSubtypes( true );
}
@Override
@@ -98,7 +94,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
Item blockItem = b.asItem();
if (blockItem != null && blockItem.getGroup() != null) {
if (blockItem != Items.AIR && blockItem.getGroup() != null) {
final NonNullList<ItemStack> tmpList = NonNullList.create();
b.fillItemGroup(blockItem.getGroup(), tmpList);
for (final ItemStack l : tmpList) {
@@ -116,31 +112,21 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
public ItemStack createFacadeForItem(final ItemStack itemStack, final boolean returnItem) {
if (itemStack.isEmpty()) {
if (itemStack.isEmpty() || itemStack.hasTag() || !(itemStack.getItem() instanceof BlockItem)) {
return ItemStack.EMPTY;
}
final Block block = Block.getBlockFromItem(itemStack.getItem());
if (block == Blocks.AIR || itemStack.hasTag()) {
BlockItem blockItem = (BlockItem) itemStack.getItem();
Block block = blockItem.getBlock();
if (block == Blocks.AIR) {
return ItemStack.EMPTY;
}
final int metadata = 0; // FIXME itemStack.getItem().getMetadata( itemStack.getDamage() );
// We only support the default state for facades. Sorry.
BlockState blockState = block.getDefaultState();
// Try to get the block state based on the item stack's meta. If this fails,
// don't consider it for a facade
// This for example fails for Pistons because they hardcoded an invalid meta
// value in vanilla
BlockState blockState;
try {
blockState = null; // FIXME block.getStateFromMeta( metadata );
} catch (Exception e) {
AELog.debug(e, "Cannot create a facade for " + block.getRegistryName());
return ItemStack.EMPTY;
}
final boolean areTileEntitiesEnabled = FacadeConfig.instance().allowTileEntityFacades();
final boolean isWhiteListed = FacadeConfig.instance().isWhiteListed(block, metadata);
final boolean areTileEntitiesEnabled = false; // FacadeConfig.instance().allowTileEntityFacades();
final boolean isWhiteListed = true; // FIXME FacadeConfig.instance().isWhiteListed(block);
final boolean isModel = blockState.getRenderType() == BlockRenderType.MODEL;
final BlockState defaultState = block.getDefaultState();