Fixed seeds, materials and other things

This commit is contained in:
Sebastian Hartte
2020-06-07 17:30:43 +02:00
parent 7693be3ec5
commit e2c62f0e27
31 changed files with 194 additions and 218 deletions
@@ -22,7 +22,6 @@ package appeng.items.materials;
import java.util.EnumSet;
import java.util.Set;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -98,7 +97,7 @@ public enum MaterialType
WOODEN_GEAR("material_wooden_gear", EnumSet.of( AEFeature.GRIND_STONE ), "gearWood" ),
WIRELESS("material_wireless", EnumSet.of( AEFeature.WIRELESS_ACCESS_TERMINAL ) ),
WIRELESS_RECEIVER("material_wireless_receiver", EnumSet.of( AEFeature.WIRELESS_ACCESS_TERMINAL ) ),
WIRELESS_BOOSTER("material_wireless_booster", EnumSet.of( AEFeature.WIRELESS_ACCESS_TERMINAL ) ),
FORMATION_CORE("material_formation_core", EnumSet.of( AEFeature.CORES ) ),
@@ -119,7 +118,7 @@ public enum MaterialType
FLUID_CELL64K_PART("material_fluid_cell64k_part", EnumSet.of( AEFeature.STORAGE_CELLS ) );
private final Set<AEFeature> features;
private final ModelResourceLocation model;
private final ResourceLocation registryName;
private Item itemInstance;
// stack!
private MaterialStackSrc stackSrc;
@@ -127,33 +126,28 @@ public enum MaterialType
private Class<? extends Entity> droppedEntity;
private boolean isRegistered = false;
MaterialType(String modelName)
{
this(modelName, EnumSet.of( AEFeature.CORE ) );
}
MaterialType(String modelName, final Set<AEFeature> features)
MaterialType(String id, final Set<AEFeature> features)
{
this.features = features;
this.model = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, modelName ), "inventory" );
this.registryName = new ResourceLocation( AppEng.MOD_ID, id);
}
MaterialType(String modelName, final Set<AEFeature> features, final Class<? extends Entity> c)
MaterialType(String id, final Set<AEFeature> features, final Class<? extends Entity> c)
{
this(modelName, features );
this(id, features );
this.droppedEntity = c;
}
MaterialType(String modelName, final Set<AEFeature> features, final String oreDictionary, final Class<? extends Entity> c)
MaterialType(String id, final Set<AEFeature> features, final String oreDictionary, final Class<? extends Entity> c)
{
this(modelName, features );
this(id, features );
this.oreName = oreDictionary;
this.droppedEntity = c;
}
MaterialType(String modelName, final Set<AEFeature> features, final String oreDictionary)
MaterialType(String id, final Set<AEFeature> features, final String oreDictionary)
{
this(modelName, features );
this(id, features );
this.oreName = oreDictionary;
}
@@ -212,9 +206,11 @@ public enum MaterialType
this.stackSrc = stackSrc;
}
public ModelResourceLocation getModel()
public String getId() { return registryName.getPath(); }
public ResourceLocation getRegistryName()
{
return this.model;
return this.registryName;
}
}
@@ -20,6 +20,7 @@ package appeng.items.misc;
import appeng.api.implementations.items.IGrowableCrystal;
import appeng.core.AppEng;
import appeng.core.localization.ButtonToolTips;
import appeng.entity.EntityGrowingCrystal;
import appeng.items.AEBaseItem;
@@ -33,6 +34,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
@@ -68,6 +70,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
public ItemCrystalSeed(Properties properties, IItemProvider grownItem) {
super(properties);
this.grownItem = Preconditions.checkNotNull(grownItem);
// Expose the growth of the seed to the model system
addPropertyOverride(new ResourceLocation("appliedenergistics2:growth"),
(is, w, p) -> getGrowthTicks(is) / (float) GROWTH_TICKS_REQUIRED);
}
@Nullable
@@ -20,7 +20,6 @@ package appeng.items.misc;
import appeng.api.util.AEColor;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
@@ -34,13 +33,12 @@ public class ItemPaintBall extends AEBaseItem
{
private static final String TAG_COLOR = "c";
private static final String TAG_LUMEN = "l";
private static final ITextComponent LUMEN_PREFIX = new TranslationTextComponent(GuiText.Lumen.getTranslationKey())
.appendText(" ");
private final boolean lumen;
public ItemPaintBall(Properties properties) {
public ItemPaintBall(Properties properties, boolean lumen) {
super(properties);
this.lumen = lumen;
}
@Override
@@ -53,12 +51,7 @@ public class ItemPaintBall extends AEBaseItem
private ITextComponent getExtraName( final ItemStack is )
{
ITextComponent colorText = new TranslationTextComponent(this.getColor(is).translationKey);
if (isLumen(is)) {
return LUMEN_PREFIX.shallowCopy().appendSibling(colorText);
} else {
return colorText;
}
return new TranslationTextComponent(this.getColor(is).translationKey);
}
public AEColor getColor( final ItemStack is )
@@ -80,16 +73,9 @@ public class ItemPaintBall extends AEBaseItem
return is;
}
public boolean isLumen( final ItemStack is )
public boolean isLumen()
{
CompoundNBT tag = is.getTag();
return tag != null && tag.getBoolean(TAG_LUMEN);
}
public ItemStack setLumen( final ItemStack is, boolean lumen )
{
is.getOrCreateTag().putBoolean(TAG_LUMEN, lumen);
return is;
return lumen;
}
@Override
@@ -102,14 +88,6 @@ public class ItemPaintBall extends AEBaseItem
itemStacks.add( setColor(new ItemStack( this ), c) );
}
}
for( final AEColor c : AEColor.values() )
{
if( c != AEColor.TRANSPARENT )
{
itemStacks.add( setLumen(setColor(new ItemStack( this ), c), true) );
}
}
}
}
@@ -31,14 +31,10 @@ import appeng.bootstrap.ItemRenderingCustomizer;
public class ItemPaintBallRendering extends ItemRenderingCustomizer
{
private static final ModelResourceLocation MODEL_NORMAL = new ModelResourceLocation( "appliedenergistics2:paint_ball" );
private static final ModelResourceLocation MODEL_SHIMMER = new ModelResourceLocation( "appliedenergistics2:paint_ball_shimmer" );
@Override
public void customize( IItemRendering rendering )
{
rendering.color( ItemPaintBallRendering::getColorFromItemstack );
rendering.variants( MODEL_NORMAL, MODEL_SHIMMER );
// FIXME rendering.meshDefinition( is -> ItemPaintBall.isLumen( is ) ? MODEL_SHIMMER : MODEL_NORMAL );
}
@@ -47,7 +43,7 @@ public class ItemPaintBallRendering extends ItemRenderingCustomizer
ItemPaintBall item = (ItemPaintBall) stack.getItem();
final AEColor col = item.getColor( stack );
boolean lumen = item.isLumen(stack);
boolean lumen = item.isLumen();
final int colorValue = lumen ? col.mediumVariant : col.mediumVariant;
final int r = ( colorValue >> 16 ) & 0xff;
final int g = ( colorValue >> 8 ) & 0xff;
@@ -66,15 +66,15 @@ public class ItemPartRendering extends ItemRenderingCustomizer
.collect( Collectors.toList() ) );
// Register the built-in models for annihilation planes
ResourceLocation annihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "items/part/annihilation_plane" );
ResourceLocation annihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/annihilation_plane" );
ResourceLocation annihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/annihilation_plane_on" );
ResourceLocation fluidAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "items/part/fluid_annihilation_plane" );
ResourceLocation fluidAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/fluid_annihilation_plane" );
ResourceLocation fluidAnnihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/fluid_annihilation_plane_on" );
ResourceLocation identityAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "items/part/identity_annihilation_plane" );
ResourceLocation identityAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/identity_annihilation_plane" );
ResourceLocation identityAnnihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/identity_annihilation_plane_on" );
ResourceLocation formationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "items/part/formation_plane" );
ResourceLocation formationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/formation_plane" );
ResourceLocation formationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/formation_plane_on" );
ResourceLocation fluidFormationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "items/part/fluid_formation_plane" );
ResourceLocation fluidFormationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/fluid_formation_plane" );
ResourceLocation fluidFormationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/fluid_formation_plane_on" );
ResourceLocation sidesTexture = new ResourceLocation( AppEng.MOD_ID, "parts/plane_sides" );
ResourceLocation backTexture = new ResourceLocation( AppEng.MOD_ID, "parts/transition_plane_back" );
@@ -1,26 +0,0 @@
package appeng.items.tools;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.bootstrap.IItemRendering;
import appeng.bootstrap.ItemRenderingCustomizer;
import appeng.core.AppEng;
public class ToolBiometricCardRendering extends ItemRenderingCustomizer
{
private static final ResourceLocation MODEL = new ResourceLocation( AppEng.MOD_ID, "builtin/biometric_card" );
@Override
@OnlyIn( Dist.CLIENT )
public void customize( IItemRendering rendering )
{
// FIXME rendering.builtInModel( "models/item/builtin/biometric_card", new BiometricCardModel() );
rendering.model( new ModelResourceLocation( MODEL, "inventory" ) ).variants( MODEL );
}
}
@@ -1,26 +0,0 @@
package appeng.items.tools;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.bootstrap.IItemRendering;
import appeng.bootstrap.ItemRenderingCustomizer;
import appeng.core.AppEng;
public class ToolMemoryCardRendering extends ItemRenderingCustomizer
{
private static final ResourceLocation MODEL = new ResourceLocation( AppEng.MOD_ID, "builtin/memory_card" );
@Override
@OnlyIn( Dist.CLIENT )
public void customize( IItemRendering rendering )
{
// FIXME rendering.builtInModel( "models/item/builtin/memory_card", new MemoryCardModel() );
rendering.model( new ModelResourceLocation( MODEL, "inventory" ) ).variants( MODEL );
}
}