Remove unused stuff
This commit is contained in:
@@ -18,11 +18,7 @@
|
||||
|
||||
package appeng.bootstrap;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -31,22 +27,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
*/
|
||||
public interface IItemRendering {
|
||||
|
||||
/**
|
||||
* Convenient override for {@link #variants(Collection)}.
|
||||
*/
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
default IItemRendering variants(ResourceLocation... resources) {
|
||||
return this.variants(Arrays.asList(resources));
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the item variants of this item. This are all models that need to be
|
||||
* loaded for this item. This has no direct effect on rendering, but is used to
|
||||
* load models that are used for example by the ItemMeshDefinition.
|
||||
*/
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
IItemRendering variants(Collection<ResourceLocation> resources);
|
||||
|
||||
/**
|
||||
* Registers a custom item color definition that inspects an item stack and tint
|
||||
* and returns a color multiplier.
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, 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.bootstrap;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public interface IModelRegistry {
|
||||
void registerItemVariants(Item item, ResourceLocation... names);
|
||||
|
||||
}
|
||||
@@ -18,33 +18,18 @@
|
||||
|
||||
package appeng.bootstrap;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.bootstrap.components.ItemColorComponent;
|
||||
import appeng.bootstrap.components.ItemVariantsComponent;
|
||||
|
||||
class ItemRendering implements IItemRendering {
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private IItemColor itemColor;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private Set<ResourceLocation> variants = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public IItemRendering variants(Collection<ResourceLocation> resources) {
|
||||
this.variants.addAll(resources);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IItemRendering color(IItemColor itemColor) {
|
||||
@@ -53,12 +38,6 @@ class ItemRendering implements IItemRendering {
|
||||
}
|
||||
|
||||
void apply(FeatureFactory factory, Item item) {
|
||||
Set<ResourceLocation> resources = new HashSet<>(this.variants);
|
||||
|
||||
if (!resources.isEmpty()) {
|
||||
factory.addBootstrapComponent(new ItemVariantsComponent(item, resources));
|
||||
}
|
||||
|
||||
if (this.itemColor != null) {
|
||||
factory.addBootstrapComponent(new ItemColorComponent(item, this.itemColor));
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, 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.bootstrap.components;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
|
||||
/**
|
||||
* @author GuntherDW
|
||||
*/
|
||||
|
||||
@FunctionalInterface
|
||||
public interface IModelRegistrationComponent extends IBootstrapComponent {
|
||||
void modelRegistration(Dist dist, IModelRegistry registry);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, 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.bootstrap.components;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
|
||||
/**
|
||||
* Registers a custom item mesh definition that can be used to dynamically
|
||||
* determine the item model based on item stack properties.
|
||||
*/
|
||||
public class ItemMeshDefinitionComponent implements IModelRegistrationComponent {
|
||||
|
||||
// FIXME private final Item item;
|
||||
// FIXME
|
||||
// FIXME private final ItemMeshDefinition meshDefinition;
|
||||
|
||||
// FIXME public ItemMeshDefinitionComponent( @Nonnull Item item, @Nonnull ItemMeshDefinition meshDefinition )
|
||||
// FIXME {
|
||||
// FIXME this.item = item;
|
||||
// FIXME this.meshDefinition = meshDefinition;
|
||||
// FIXME }
|
||||
|
||||
@Override
|
||||
public void modelRegistration(Dist dist, IModelRegistry registry) {
|
||||
// FIXME registry.setCustomMeshDefinition( this.item, this.meshDefinition );
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, 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.bootstrap.components;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
|
||||
public class ItemVariantsComponent implements IModelRegistrationComponent {
|
||||
|
||||
private final Item item;
|
||||
|
||||
private final Collection<ResourceLocation> resources;
|
||||
|
||||
public ItemVariantsComponent(Item item, Collection<ResourceLocation> resources) {
|
||||
this.item = item;
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modelRegistration(Dist dist, IModelRegistry registry) {
|
||||
ResourceLocation[] resourceArr = this.resources.toArray(new ResourceLocation[0]);
|
||||
registry.registerItemVariants(this.item, resourceArr);
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, 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.bootstrap.components;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
|
||||
/**
|
||||
* Registers a custom state mapper for a given block.
|
||||
*/
|
||||
public class StateMapperComponent implements IModelRegistrationComponent {
|
||||
|
||||
// FIXME private final Block block;
|
||||
|
||||
// FIXME private final IStateMapper stateMapper;
|
||||
// FIXME
|
||||
// FIXME public StateMapperComponent( Block block, IStateMapper stateMapper )
|
||||
// FIXME {
|
||||
// FIXME this.block = block;
|
||||
// FIXME this.stateMapper = stateMapper;
|
||||
// FIXME }
|
||||
|
||||
@Override
|
||||
public void modelRegistration(Dist dist, IModelRegistry registry) {
|
||||
// FIXME registry.setCustomStateMapper( this.block, this.stateMapper );
|
||||
// FIXME if( this.stateMapper instanceof IResourceManagerReloadListener )
|
||||
// FIXME {
|
||||
// FIXME ( (IReloadableResourceManager)
|
||||
// Minecraft.getInstance().getResourceManager() )
|
||||
// FIXME .registerReloadListener( (IResourceManagerReloadListener)
|
||||
// this.stateMapper );
|
||||
// FIXME }
|
||||
}
|
||||
}
|
||||
@@ -77,13 +77,11 @@ import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.networking.spatial.ISpatialCache;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.networking.ticking.ITickManager;
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||
import appeng.bootstrap.components.IEntityRegistrationComponent;
|
||||
import appeng.bootstrap.components.IItemColorRegistrationComponent;
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IModelBakeComponent;
|
||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||
import appeng.bootstrap.components.ITileEntityRegistrationComponent;
|
||||
import appeng.client.gui.implementations.GuiCellWorkbench;
|
||||
import appeng.client.gui.implementations.GuiChest;
|
||||
@@ -241,15 +239,6 @@ final class Registration {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void modelRegistryEvent(ModelRegistryEvent event) {
|
||||
registerSpecialModels();
|
||||
|
||||
// TODO: Do not use the internal API
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final IModelRegistry registry = (item, names) -> {
|
||||
// FIXME REMOVE OR IMPL
|
||||
};
|
||||
final Dist dist = FMLEnvironment.dist;
|
||||
definitions.getRegistry().getBootstrapComponents(IModelRegistrationComponent.class)
|
||||
.forEachRemaining(b -> b.modelRegistration(dist, registry));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.util.Map;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.api.features.IMatterCannonAmmoRegistry;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class MatterCannonAmmoRegistry implements IMatterCannonAmmoRegistry {
|
||||
|
||||
@@ -38,77 +38,77 @@ public class MatterCannonAmmoRegistry implements IMatterCannonAmmoRegistry {
|
||||
private final Map<Item, Double> itemDamageModifiers = new IdentityHashMap<>();
|
||||
|
||||
public MatterCannonAmmoRegistry() {
|
||||
this.addTagWeight( "forge:nuggets/meatraw", 32 );
|
||||
this.addTagWeight( "forge:nuggets/meatcooked", 32 );
|
||||
this.addTagWeight( "forge:nuggets/meat", 32 );
|
||||
this.addTagWeight( "forge:nuggets/chicken", 32 );
|
||||
this.addTagWeight( "forge:nuggets/beef", 32 );
|
||||
this.addTagWeight( "forge:nuggets/sheep", 32 );
|
||||
this.addTagWeight( "forge:nuggets/fish", 32 );
|
||||
this.addTagWeight("forge:nuggets/meatraw", 32);
|
||||
this.addTagWeight("forge:nuggets/meatcooked", 32);
|
||||
this.addTagWeight("forge:nuggets/meat", 32);
|
||||
this.addTagWeight("forge:nuggets/chicken", 32);
|
||||
this.addTagWeight("forge:nuggets/beef", 32);
|
||||
this.addTagWeight("forge:nuggets/sheep", 32);
|
||||
this.addTagWeight("forge:nuggets/fish", 32);
|
||||
|
||||
// real world...
|
||||
this.addTagWeight( "forge:nuggets/lithium", 6.941 );
|
||||
this.addTagWeight( "forge:nuggets/beryllium", 9.0122 );
|
||||
this.addTagWeight( "forge:nuggets/boron", 10.811 );
|
||||
this.addTagWeight( "forge:nuggets/carbon", 12.0107 );
|
||||
this.addTagWeight( "forge:nuggets/coal", 12.0107 );
|
||||
this.addTagWeight( "forge:nuggets/charcoal", 12.0107 );
|
||||
this.addTagWeight( "forge:nuggets/sodium", 22.9897 );
|
||||
this.addTagWeight( "forge:nuggets/magnesium", 24.305 );
|
||||
this.addTagWeight( "forge:nuggets/aluminum", 26.9815 );
|
||||
this.addTagWeight( "forge:nuggets/silicon", 28.0855 );
|
||||
this.addTagWeight( "forge:nuggets/phosphorus", 30.9738 );
|
||||
this.addTagWeight( "forge:nuggets/sulfur", 32.065 );
|
||||
this.addTagWeight( "forge:nuggets/potassium", 39.0983 );
|
||||
this.addTagWeight( "forge:nuggets/calcium", 40.078 );
|
||||
this.addTagWeight( "forge:nuggets/scandium", 44.9559 );
|
||||
this.addTagWeight( "forge:nuggets/titanium", 47.867 );
|
||||
this.addTagWeight( "forge:nuggets/vanadium", 50.9415 );
|
||||
this.addTagWeight( "forge:nuggets/manganese", 54.938 );
|
||||
this.addTagWeight( "forge:nuggets/iron", 55.845 );
|
||||
this.addTagWeight( "forge:nuggets/gold", 196.96655 );
|
||||
this.addTagWeight( "forge:nuggets/nickel", 58.6934 );
|
||||
this.addTagWeight( "forge:nuggets/cobalt", 58.9332 );
|
||||
this.addTagWeight( "forge:nuggets/copper", 63.546 );
|
||||
this.addTagWeight( "forge:nuggets/zinc", 65.39 );
|
||||
this.addTagWeight( "forge:nuggets/gallium", 69.723 );
|
||||
this.addTagWeight( "forge:nuggets/germanium", 72.64 );
|
||||
this.addTagWeight( "forge:nuggets/bromine", 79.904 );
|
||||
this.addTagWeight( "forge:nuggets/krypton", 83.8 );
|
||||
this.addTagWeight( "forge:nuggets/rubidium", 85.4678 );
|
||||
this.addTagWeight( "forge:nuggets/strontium", 87.62 );
|
||||
this.addTagWeight( "forge:nuggets/yttrium", 88.9059 );
|
||||
this.addTagWeight( "forge:nuggets/zirconium", 91.224 );
|
||||
this.addTagWeight( "forge:nuggets/niobium", 92.9064 );
|
||||
this.addTagWeight( "forge:nuggets/technetium", 98 );
|
||||
this.addTagWeight( "forge:nuggets/ruthenium", 101.07 );
|
||||
this.addTagWeight( "forge:nuggets/rhodium", 102.9055 );
|
||||
this.addTagWeight( "forge:nuggets/palladium", 106.42 );
|
||||
this.addTagWeight( "forge:nuggets/silver", 107.8682 );
|
||||
this.addTagWeight( "forge:nuggets/cadmium", 112.411 );
|
||||
this.addTagWeight( "forge:nuggets/indium", 114.818 );
|
||||
this.addTagWeight( "forge:nuggets/tin", 118.71 );
|
||||
this.addTagWeight( "forge:nuggets/antimony", 121.76 );
|
||||
this.addTagWeight( "forge:nuggets/iodine", 126.9045 );
|
||||
this.addTagWeight( "forge:nuggets/tellurium", 127.6 );
|
||||
this.addTagWeight( "forge:nuggets/xenon", 131.293 );
|
||||
this.addTagWeight( "forge:nuggets/cesium", 132.9055 );
|
||||
this.addTagWeight( "forge:nuggets/barium", 137.327 );
|
||||
this.addTagWeight( "forge:nuggets/lanthanum", 138.9055 );
|
||||
this.addTagWeight( "forge:nuggets/cerium", 140.116 );
|
||||
this.addTagWeight( "forge:nuggets/tantalum", 180.9479 );
|
||||
this.addTagWeight( "forge:nuggets/tungsten", 183.84 );
|
||||
this.addTagWeight( "forge:nuggets/osmium", 190.23 );
|
||||
this.addTagWeight( "forge:nuggets/iridium", 192.217 );
|
||||
this.addTagWeight( "forge:nuggets/platinum", 195.078 );
|
||||
this.addTagWeight( "forge:nuggets/lead", 207.2 );
|
||||
this.addTagWeight( "forge:nuggets/bismuth", 208.9804 );
|
||||
this.addTagWeight( "forge:nuggets/uranium", 238.0289 );
|
||||
this.addTagWeight( "forge:nuggets/plutonium", 244 );
|
||||
this.addTagWeight("forge:nuggets/lithium", 6.941);
|
||||
this.addTagWeight("forge:nuggets/beryllium", 9.0122);
|
||||
this.addTagWeight("forge:nuggets/boron", 10.811);
|
||||
this.addTagWeight("forge:nuggets/carbon", 12.0107);
|
||||
this.addTagWeight("forge:nuggets/coal", 12.0107);
|
||||
this.addTagWeight("forge:nuggets/charcoal", 12.0107);
|
||||
this.addTagWeight("forge:nuggets/sodium", 22.9897);
|
||||
this.addTagWeight("forge:nuggets/magnesium", 24.305);
|
||||
this.addTagWeight("forge:nuggets/aluminum", 26.9815);
|
||||
this.addTagWeight("forge:nuggets/silicon", 28.0855);
|
||||
this.addTagWeight("forge:nuggets/phosphorus", 30.9738);
|
||||
this.addTagWeight("forge:nuggets/sulfur", 32.065);
|
||||
this.addTagWeight("forge:nuggets/potassium", 39.0983);
|
||||
this.addTagWeight("forge:nuggets/calcium", 40.078);
|
||||
this.addTagWeight("forge:nuggets/scandium", 44.9559);
|
||||
this.addTagWeight("forge:nuggets/titanium", 47.867);
|
||||
this.addTagWeight("forge:nuggets/vanadium", 50.9415);
|
||||
this.addTagWeight("forge:nuggets/manganese", 54.938);
|
||||
this.addTagWeight("forge:nuggets/iron", 55.845);
|
||||
this.addTagWeight("forge:nuggets/gold", 196.96655);
|
||||
this.addTagWeight("forge:nuggets/nickel", 58.6934);
|
||||
this.addTagWeight("forge:nuggets/cobalt", 58.9332);
|
||||
this.addTagWeight("forge:nuggets/copper", 63.546);
|
||||
this.addTagWeight("forge:nuggets/zinc", 65.39);
|
||||
this.addTagWeight("forge:nuggets/gallium", 69.723);
|
||||
this.addTagWeight("forge:nuggets/germanium", 72.64);
|
||||
this.addTagWeight("forge:nuggets/bromine", 79.904);
|
||||
this.addTagWeight("forge:nuggets/krypton", 83.8);
|
||||
this.addTagWeight("forge:nuggets/rubidium", 85.4678);
|
||||
this.addTagWeight("forge:nuggets/strontium", 87.62);
|
||||
this.addTagWeight("forge:nuggets/yttrium", 88.9059);
|
||||
this.addTagWeight("forge:nuggets/zirconium", 91.224);
|
||||
this.addTagWeight("forge:nuggets/niobium", 92.9064);
|
||||
this.addTagWeight("forge:nuggets/technetium", 98);
|
||||
this.addTagWeight("forge:nuggets/ruthenium", 101.07);
|
||||
this.addTagWeight("forge:nuggets/rhodium", 102.9055);
|
||||
this.addTagWeight("forge:nuggets/palladium", 106.42);
|
||||
this.addTagWeight("forge:nuggets/silver", 107.8682);
|
||||
this.addTagWeight("forge:nuggets/cadmium", 112.411);
|
||||
this.addTagWeight("forge:nuggets/indium", 114.818);
|
||||
this.addTagWeight("forge:nuggets/tin", 118.71);
|
||||
this.addTagWeight("forge:nuggets/antimony", 121.76);
|
||||
this.addTagWeight("forge:nuggets/iodine", 126.9045);
|
||||
this.addTagWeight("forge:nuggets/tellurium", 127.6);
|
||||
this.addTagWeight("forge:nuggets/xenon", 131.293);
|
||||
this.addTagWeight("forge:nuggets/cesium", 132.9055);
|
||||
this.addTagWeight("forge:nuggets/barium", 137.327);
|
||||
this.addTagWeight("forge:nuggets/lanthanum", 138.9055);
|
||||
this.addTagWeight("forge:nuggets/cerium", 140.116);
|
||||
this.addTagWeight("forge:nuggets/tantalum", 180.9479);
|
||||
this.addTagWeight("forge:nuggets/tungsten", 183.84);
|
||||
this.addTagWeight("forge:nuggets/osmium", 190.23);
|
||||
this.addTagWeight("forge:nuggets/iridium", 192.217);
|
||||
this.addTagWeight("forge:nuggets/platinum", 195.078);
|
||||
this.addTagWeight("forge:nuggets/lead", 207.2);
|
||||
this.addTagWeight("forge:nuggets/bismuth", 208.9804);
|
||||
this.addTagWeight("forge:nuggets/uranium", 238.0289);
|
||||
this.addTagWeight("forge:nuggets/plutonium", 244);
|
||||
|
||||
// TE stuff...
|
||||
this.addTagWeight( "forge:nuggets/invar", ( 58.6934 + 55.845 + 55.845 ) / 3.0 );
|
||||
this.addTagWeight( "forge:nuggets/electrum", ( 107.8682 + 196.96655 ) / 2.0 );
|
||||
this.addTagWeight("forge:nuggets/invar", (58.6934 + 55.845 + 55.845) / 3.0);
|
||||
this.addTagWeight("forge:nuggets/electrum", (107.8682 + 196.96655) / 2.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,484 +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.core.sync;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.exceptions.AppEngException;
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
import appeng.api.implementations.guiobjects.INetworkTool;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.container.implementations.ContainerCellWorkbench;
|
||||
import appeng.container.implementations.ContainerChest;
|
||||
import appeng.container.implementations.ContainerCondenser;
|
||||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.container.implementations.ContainerCraftingCPU;
|
||||
import appeng.container.implementations.ContainerCraftingStatus;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.container.implementations.ContainerDrive;
|
||||
import appeng.container.implementations.ContainerFormationPlane;
|
||||
import appeng.container.implementations.ContainerGrinder;
|
||||
import appeng.container.implementations.ContainerIOPort;
|
||||
import appeng.container.implementations.ContainerInscriber;
|
||||
import appeng.container.implementations.ContainerInterface;
|
||||
import appeng.container.implementations.ContainerInterfaceTerminal;
|
||||
import appeng.container.implementations.ContainerLevelEmitter;
|
||||
import appeng.container.implementations.ContainerMEMonitorable;
|
||||
import appeng.container.implementations.ContainerMEPortableCell;
|
||||
import appeng.container.implementations.ContainerMolecularAssembler;
|
||||
import appeng.container.implementations.ContainerNetworkStatus;
|
||||
import appeng.container.implementations.ContainerNetworkTool;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.container.implementations.ContainerPriority;
|
||||
import appeng.container.implementations.ContainerQNB;
|
||||
import appeng.container.implementations.ContainerQuartzKnife;
|
||||
import appeng.container.implementations.ContainerSecurityStation;
|
||||
import appeng.container.implementations.ContainerSkyChest;
|
||||
import appeng.container.implementations.ContainerSpatialIOPort;
|
||||
import appeng.container.implementations.ContainerStorageBus;
|
||||
import appeng.container.implementations.ContainerUpgradeable;
|
||||
import appeng.container.implementations.ContainerVibrationChamber;
|
||||
import appeng.container.implementations.ContainerWireless;
|
||||
import appeng.container.implementations.ContainerWirelessTerm;
|
||||
import appeng.fluids.container.ContainerFluidFormationPlane;
|
||||
import appeng.fluids.container.ContainerFluidIO;
|
||||
import appeng.fluids.container.ContainerFluidInterface;
|
||||
import appeng.fluids.container.ContainerFluidLevelEmitter;
|
||||
import appeng.fluids.container.ContainerFluidStorageBus;
|
||||
import appeng.fluids.container.ContainerFluidTerminal;
|
||||
import appeng.fluids.helper.IFluidInterfaceHost;
|
||||
import appeng.fluids.parts.PartFluidFormationPlane;
|
||||
import appeng.fluids.parts.PartFluidLevelEmitter;
|
||||
import appeng.fluids.parts.PartFluidStorageBus;
|
||||
import appeng.fluids.parts.PartSharedFluidBus;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.items.contents.QuartzKnifeObj;
|
||||
import appeng.parts.automation.PartFormationPlane;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.parts.reporting.PartInterfaceTerminal;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
import appeng.tile.misc.TileCellWorkbench;
|
||||
import appeng.tile.misc.TileCondenser;
|
||||
import appeng.tile.misc.TileInscriber;
|
||||
import appeng.tile.misc.TileSecurityStation;
|
||||
import appeng.tile.misc.TileVibrationChamber;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import appeng.tile.spatial.TileSpatialIOPort;
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public enum GuiBridge {
|
||||
GUI_Handler(),
|
||||
|
||||
GUI_GRINDER(ContainerGrinder.class, TileGrinder.class, GuiHostType.WORLD, null),
|
||||
|
||||
GUI_QNB(ContainerQNB.class, TileQuantumBridge.class, GuiHostType.WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_SKYCHEST(ContainerSkyChest.class, TileSkyChest.class, GuiHostType.WORLD, null),
|
||||
|
||||
GUI_CHEST(ContainerChest.class, TileChest.class, GuiHostType.WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_WIRELESS(ContainerWireless.class, TileWireless.class, GuiHostType.WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_ME(ContainerMEMonitorable.class, ITerminalHost.class, GuiHostType.WORLD, null),
|
||||
|
||||
GUI_PORTABLE_CELL(ContainerMEPortableCell.class, IPortableCell.class, GuiHostType.ITEM, null),
|
||||
|
||||
GUI_WIRELESS_TERM(ContainerWirelessTerm.class, WirelessTerminalGuiObject.class, GuiHostType.ITEM, null),
|
||||
|
||||
GUI_NETWORK_STATUS(ContainerNetworkStatus.class, INetworkTool.class, GuiHostType.ITEM, null),
|
||||
|
||||
GUI_CRAFTING_CPU(ContainerCraftingCPU.class, TileCraftingTile.class, GuiHostType.WORLD, SecurityPermissions.CRAFT),
|
||||
|
||||
GUI_NETWORK_TOOL(ContainerNetworkTool.class, INetworkTool.class, GuiHostType.ITEM, null),
|
||||
|
||||
GUI_QUARTZ_KNIFE(ContainerQuartzKnife.class, QuartzKnifeObj.class, GuiHostType.ITEM, null),
|
||||
|
||||
GUI_DRIVE(ContainerDrive.class, TileDrive.class, GuiHostType.WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_VIBRATION_CHAMBER(ContainerVibrationChamber.class, TileVibrationChamber.class, GuiHostType.WORLD, null),
|
||||
|
||||
GUI_CONDENSER(ContainerCondenser.class, TileCondenser.class, GuiHostType.WORLD, null),
|
||||
|
||||
GUI_INTERFACE(ContainerInterface.class, IInterfaceHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_FLUID_INTERFACE(ContainerFluidInterface.class, IFluidInterfaceHost.class, GuiHostType.WORLD,
|
||||
SecurityPermissions.BUILD),
|
||||
|
||||
GUI_BUS(ContainerUpgradeable.class, IUpgradeableHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_BUS_FLUID(ContainerFluidIO.class, PartSharedFluidBus.class, GuiHostType.WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_IOPORT(ContainerIOPort.class, TileIOPort.class, GuiHostType.WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_STORAGEBUS(ContainerStorageBus.class, PartStorageBus.class, GuiHostType.WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_STORAGEBUS_FLUID(ContainerFluidStorageBus.class, PartFluidStorageBus.class, GuiHostType.WORLD,
|
||||
SecurityPermissions.BUILD),
|
||||
|
||||
GUI_FORMATION_PLANE(ContainerFormationPlane.class, PartFormationPlane.class, GuiHostType.WORLD,
|
||||
SecurityPermissions.BUILD),
|
||||
|
||||
GUI_FLUID_FORMATION_PLANE(ContainerFluidFormationPlane.class, PartFluidFormationPlane.class, GuiHostType.WORLD,
|
||||
SecurityPermissions.BUILD),
|
||||
|
||||
GUI_PRIORITY(ContainerPriority.class, IPriorityHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_SECURITY(ContainerSecurityStation.class, TileSecurityStation.class, GuiHostType.WORLD,
|
||||
SecurityPermissions.SECURITY),
|
||||
|
||||
GUI_CRAFTING_TERMINAL(ContainerCraftingTerm.class, PartCraftingTerminal.class, GuiHostType.WORLD,
|
||||
SecurityPermissions.CRAFT),
|
||||
|
||||
GUI_PATTERN_TERMINAL(ContainerPatternTerm.class, PartPatternTerminal.class, GuiHostType.WORLD,
|
||||
SecurityPermissions.CRAFT),
|
||||
|
||||
GUI_FLUID_TERMINAL(ContainerFluidTerminal.class, ITerminalHost.class, GuiHostType.WORLD, SecurityPermissions.BUILD),
|
||||
|
||||
// extends (Container/Gui) + Bus
|
||||
GUI_LEVEL_EMITTER(ContainerLevelEmitter.class, PartLevelEmitter.class, GuiHostType.WORLD,
|
||||
SecurityPermissions.BUILD),
|
||||
|
||||
GUI_FLUID_LEVEL_EMITTER(ContainerFluidLevelEmitter.class, PartFluidLevelEmitter.class, GuiHostType.WORLD,
|
||||
SecurityPermissions.BUILD),
|
||||
|
||||
GUI_SPATIAL_IO_PORT(ContainerSpatialIOPort.class, TileSpatialIOPort.class, GuiHostType.WORLD,
|
||||
SecurityPermissions.BUILD),
|
||||
|
||||
GUI_INSCRIBER(ContainerInscriber.class, TileInscriber.class, GuiHostType.WORLD, null),
|
||||
|
||||
GUI_CELL_WORKBENCH(ContainerCellWorkbench.class, TileCellWorkbench.class, GuiHostType.WORLD, null),
|
||||
|
||||
GUI_MAC(ContainerMolecularAssembler.class, TileMolecularAssembler.class, GuiHostType.WORLD, null),
|
||||
|
||||
GUI_CRAFTING_AMOUNT(ContainerCraftAmount.class, ITerminalHost.class, GuiHostType.ITEM_OR_WORLD,
|
||||
SecurityPermissions.CRAFT),
|
||||
|
||||
GUI_CRAFTING_CONFIRM(ContainerCraftConfirm.class, ITerminalHost.class, GuiHostType.ITEM_OR_WORLD,
|
||||
SecurityPermissions.CRAFT),
|
||||
|
||||
GUI_INTERFACE_TERMINAL(ContainerInterfaceTerminal.class, PartInterfaceTerminal.class, GuiHostType.WORLD,
|
||||
SecurityPermissions.BUILD),
|
||||
|
||||
GUI_CRAFTING_STATUS(ContainerCraftingStatus.class, ITerminalHost.class, GuiHostType.ITEM_OR_WORLD,
|
||||
SecurityPermissions.CRAFT);
|
||||
|
||||
private final Class tileClass;
|
||||
private final Class containerClass;
|
||||
private Class guiClass;
|
||||
private GuiHostType type;
|
||||
private SecurityPermissions requiredPermission;
|
||||
|
||||
GuiBridge() {
|
||||
this.tileClass = null;
|
||||
this.guiClass = null;
|
||||
this.containerClass = null;
|
||||
}
|
||||
|
||||
GuiBridge(final Class containerClass, final SecurityPermissions requiredPermission) {
|
||||
this.requiredPermission = requiredPermission;
|
||||
this.containerClass = containerClass;
|
||||
this.tileClass = null;
|
||||
this.getGui();
|
||||
}
|
||||
|
||||
/**
|
||||
* I honestly wish I could just use the GuiClass Names myself, but I can't
|
||||
* access them without MC's Server Exploding.
|
||||
*/
|
||||
private void getGui() {
|
||||
if (Platform.isClient()) {
|
||||
AEBaseGui.class.getName();
|
||||
|
||||
final String start = this.containerClass.getName();
|
||||
final String guiClass = start.replaceFirst("container.", "client.gui.").replace(".Container", ".Gui");
|
||||
|
||||
if (start.equals(guiClass)) {
|
||||
throw new IllegalStateException("Unable to find gui class");
|
||||
}
|
||||
this.guiClass = null; // FIXME ReflectionHelper.getClass( this.getClass().getClassLoader(), guiClass
|
||||
// );
|
||||
if (this.guiClass == null) {
|
||||
throw new IllegalStateException("Cannot Load class: " + guiClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GuiBridge(final Class containerClass, final Class tileClass, final GuiHostType type,
|
||||
final SecurityPermissions requiredPermission) {
|
||||
this.requiredPermission = requiredPermission;
|
||||
this.containerClass = containerClass;
|
||||
this.type = type;
|
||||
this.tileClass = tileClass;
|
||||
this.getGui();
|
||||
}
|
||||
|
||||
public Object getServerGuiElement(final int ordinal, final PlayerEntity player, final World w, final int x,
|
||||
final int y, final int z) {
|
||||
final AEPartLocation side = AEPartLocation.fromOrdinal(ordinal & 0x07);
|
||||
final GuiBridge ID = values()[ordinal >> 4];
|
||||
final boolean stem = ((ordinal >> 3) & 1) == 1;
|
||||
if (ID.type.isItem()) {
|
||||
ItemStack it = ItemStack.EMPTY;
|
||||
if (stem) {
|
||||
it = player.inventory.getCurrentItem();
|
||||
} else if (x >= 0 && x < player.inventory.mainInventory.size()) {
|
||||
it = player.inventory.getStackInSlot(x);
|
||||
}
|
||||
final Object myItem = this.getGuiObject(it, player, w, x, y, z);
|
||||
if (myItem != null && ID.CorrectTileOrPart(myItem)) {
|
||||
return this.updateGui(ID.ConstructContainer(player.inventory, side, myItem), w, x, y, z, side, myItem);
|
||||
}
|
||||
}
|
||||
if (ID.type.isTile()) {
|
||||
final TileEntity TE = w.getTileEntity(new BlockPos(x, y, z));
|
||||
if (TE instanceof IPartHost) {
|
||||
((IPartHost) TE).getPart(side);
|
||||
final IPart part = ((IPartHost) TE).getPart(side);
|
||||
if (ID.CorrectTileOrPart(part)) {
|
||||
return this.updateGui(ID.ConstructContainer(player.inventory, side, part), w, x, y, z, side, part);
|
||||
}
|
||||
} else {
|
||||
if (ID.CorrectTileOrPart(TE)) {
|
||||
return this.updateGui(ID.ConstructContainer(player.inventory, side, TE), w, x, y, z, side, TE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new ContainerNull();
|
||||
}
|
||||
|
||||
private Object getGuiObject(final ItemStack it, final PlayerEntity player, final World w, final int x, final int y,
|
||||
final int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean CorrectTileOrPart(final Object tE) {
|
||||
if (this.tileClass == null) {
|
||||
throw new IllegalArgumentException("This Gui Cannot use the standard Handler.");
|
||||
}
|
||||
|
||||
return this.tileClass.isInstance(tE);
|
||||
}
|
||||
|
||||
private Object updateGui(final Object newContainer, final World w, final int x, final int y, final int z,
|
||||
final AEPartLocation side, final Object myItem) {
|
||||
if (newContainer instanceof AEBaseContainer) {
|
||||
// FIXME final AEBaseContainer bc = (AEBaseContainer) newContainer;
|
||||
// FIXME bc.setLocator( new ContainerLocator( myItem ) );
|
||||
// FIXME bc.getLocator().setWorld( w );
|
||||
// FIXME bc.getLocator().setX( x );
|
||||
// FIXME bc.getLocator().setY( y );
|
||||
// FIXME bc.getLocator().setZ( z );
|
||||
// FIXME bc.getLocator().setSide( side );
|
||||
}
|
||||
|
||||
return newContainer;
|
||||
}
|
||||
|
||||
public Object ConstructContainer(final PlayerInventory inventory, final AEPartLocation side, final Object tE) {
|
||||
try {
|
||||
final Constructor[] c = this.containerClass.getConstructors();
|
||||
if (c.length == 0) {
|
||||
throw new AppEngException("Invalid Gui Class");
|
||||
}
|
||||
|
||||
final Constructor target = this.findConstructor(c, inventory, tE);
|
||||
|
||||
if (target == null) {
|
||||
throw new IllegalStateException("Cannot find " + this.containerClass.getName() + "( "
|
||||
+ this.typeName(inventory) + ", " + this.typeName(tE) + " )");
|
||||
}
|
||||
|
||||
return target.newInstance(inventory, tE);
|
||||
} catch (final Throwable t) {
|
||||
throw new IllegalStateException(t);
|
||||
}
|
||||
}
|
||||
|
||||
private Constructor findConstructor(final Constructor[] c, final PlayerInventory inventory, final Object tE) {
|
||||
for (final Constructor con : c) {
|
||||
final Class[] types = con.getParameterTypes();
|
||||
if (types.length == 2) {
|
||||
if (types[0].isAssignableFrom(inventory.getClass()) && types[1].isAssignableFrom(tE.getClass())) {
|
||||
return con;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String typeName(final Object inventory) {
|
||||
if (inventory == null) {
|
||||
return "NULL";
|
||||
}
|
||||
|
||||
return inventory.getClass().getName();
|
||||
}
|
||||
|
||||
public Object getClientGuiElement(final int ordinal, final PlayerEntity player, final World w, final int x,
|
||||
final int y, final int z) {
|
||||
final AEPartLocation side = AEPartLocation.fromOrdinal(ordinal & 0x07);
|
||||
final GuiBridge ID = values()[ordinal >> 4];
|
||||
final boolean stem = ((ordinal >> 3) & 1) == 1;
|
||||
if (ID.type.isItem()) {
|
||||
ItemStack it = ItemStack.EMPTY;
|
||||
if (stem) {
|
||||
it = player.inventory.getCurrentItem();
|
||||
} else if (x >= 0 && x < player.inventory.mainInventory.size()) {
|
||||
it = player.inventory.getStackInSlot(x);
|
||||
}
|
||||
final Object myItem = this.getGuiObject(it, player, w, x, y, z);
|
||||
if (myItem != null && ID.CorrectTileOrPart(myItem)) {
|
||||
return ID.ConstructGui(player.inventory, side, myItem);
|
||||
}
|
||||
}
|
||||
if (ID.type.isTile()) {
|
||||
final TileEntity TE = w.getTileEntity(new BlockPos(x, y, z));
|
||||
if (TE instanceof IPartHost) {
|
||||
((IPartHost) TE).getPart(side);
|
||||
final IPart part = ((IPartHost) TE).getPart(side);
|
||||
if (ID.CorrectTileOrPart(part)) {
|
||||
return ID.ConstructGui(player.inventory, side, part);
|
||||
}
|
||||
} else {
|
||||
if (ID.CorrectTileOrPart(TE)) {
|
||||
return ID.ConstructGui(player.inventory, side, TE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null; // FIXME
|
||||
}
|
||||
|
||||
public Object ConstructGui(final PlayerInventory inventory, final AEPartLocation side, final Object tE) {
|
||||
try {
|
||||
final Constructor[] c = this.guiClass.getConstructors();
|
||||
if (c.length == 0) {
|
||||
throw new AppEngException("Invalid Gui Class");
|
||||
}
|
||||
|
||||
final Constructor target = this.findConstructor(c, inventory, tE);
|
||||
|
||||
if (target == null) {
|
||||
throw new IllegalStateException("Cannot find " + this.containerClass.getName() + "( "
|
||||
+ this.typeName(inventory) + ", " + this.typeName(tE) + " )");
|
||||
}
|
||||
|
||||
return target.newInstance(inventory, tE);
|
||||
} catch (final Throwable t) {
|
||||
throw new IllegalStateException(t);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasPermissions(final TileEntity te, final int x, final int y, final int z, final AEPartLocation side,
|
||||
final PlayerEntity player) {
|
||||
final World w = player.getEntityWorld();
|
||||
final BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
if (Platform.hasPermissions(te != null ? new DimensionalCoord(te) : new DimensionalCoord(player.world, pos),
|
||||
player)) {
|
||||
if (this.type.isItem()) {
|
||||
final ItemStack it = player.inventory.getCurrentItem();
|
||||
if (!it.isEmpty() && it.getItem() instanceof IGuiItem) {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.type.isTile()) {
|
||||
final TileEntity TE = w.getTileEntity(pos);
|
||||
if (TE instanceof IPartHost) {
|
||||
((IPartHost) TE).getPart(side);
|
||||
final IPart part = ((IPartHost) TE).getPart(side);
|
||||
if (this.CorrectTileOrPart(part)) {
|
||||
return this.securityCheck(part, player);
|
||||
}
|
||||
} else {
|
||||
if (this.CorrectTileOrPart(TE)) {
|
||||
return this.securityCheck(TE, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean securityCheck(final Object te, final PlayerEntity player) {
|
||||
if (te instanceof IActionHost && this.requiredPermission != null) {
|
||||
|
||||
final IGridNode gn = ((IActionHost) te).getActionableNode();
|
||||
if (gn != null) {
|
||||
final IGrid g = gn.getGrid();
|
||||
if (g != null) {
|
||||
final boolean requirePower = false;
|
||||
if (requirePower) {
|
||||
final IEnergyGrid eg = g.getCache(IEnergyGrid.class);
|
||||
if (!eg.isNetworkPowered()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
final ISecurityGrid sg = g.getCache(ISecurityGrid.class);
|
||||
if (sg.hasPermission(player, this.requiredPermission)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public GuiHostType getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,28 +13,10 @@ import appeng.core.AppEng;
|
||||
|
||||
public class ToolColorApplicatorRendering extends ItemRenderingCustomizer {
|
||||
|
||||
private static final ModelResourceLocation MODEL_COLORED = new ModelResourceLocation(
|
||||
new ResourceLocation(AppEng.MOD_ID, "builtin/color_applicator_colored"), "inventory");
|
||||
private static final ModelResourceLocation MODEL_UNCOLORED = new ModelResourceLocation(
|
||||
new ResourceLocation(AppEng.MOD_ID, "color_applicator_uncolored"), "inventory");
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void customize(IItemRendering rendering) {
|
||||
// FIXME rendering.builtInModel( "models/item/builtin/color_applicator_colored",
|
||||
// new ColorApplicatorModel() );
|
||||
rendering.variants(MODEL_COLORED, MODEL_UNCOLORED);
|
||||
rendering.color(this::getColor);
|
||||
// FIXME rendering.meshDefinition( this::getMesh );
|
||||
}
|
||||
|
||||
private ModelResourceLocation getMesh(ItemStack itemStack) {
|
||||
// If the stack has no color, don't use the colored model since the impact of
|
||||
// calling getColor for every quad is
|
||||
// extremely high,
|
||||
// if the stack tries to re-search its inventory for a new paintball everytime
|
||||
AEColor col = ((ToolColorApplicator) itemStack.getItem()).getActiveColor(itemStack);
|
||||
return (col != null) ? MODEL_COLORED : MODEL_UNCOLORED;
|
||||
}
|
||||
|
||||
private int getColor(ItemStack itemStack, int idx) {
|
||||
|
||||
Reference in New Issue
Block a user