Lots of compile fixes
This commit is contained in:
@@ -33,10 +33,10 @@ import java.util.regex.Pattern;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@@ -45,6 +45,8 @@ import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -76,9 +78,9 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
|
||||
private final Map<Integer, MaterialType> dmgToMaterial = new HashMap<>();
|
||||
|
||||
public ItemMaterial()
|
||||
{
|
||||
this.setHasSubtypes( true );
|
||||
public ItemMaterial(Properties properties) {
|
||||
super(properties);
|
||||
// FIXME this.setHasSubtypes( true );
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@@ -97,16 +99,16 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
if( mt == MaterialType.NAME_PRESS )
|
||||
{
|
||||
final CompoundNBT c = stack.getOrCreateTag();
|
||||
lines.add( c.getString( "InscribeName" ) );
|
||||
lines.add( new StringTextComponent( c.getString( "InscribeName" ) ) );
|
||||
}
|
||||
|
||||
final Upgrades u = this.getType( stack );
|
||||
if( u != null )
|
||||
{
|
||||
final List<String> textList = new ArrayList<>();
|
||||
final List<ITextComponent> textList = new ArrayList<>();
|
||||
for( final Entry<ItemStack, Integer> j : u.getSupported().entrySet() )
|
||||
{
|
||||
String name = null;
|
||||
ITextComponent name = null;
|
||||
|
||||
final int limit = j.getValue();
|
||||
|
||||
@@ -116,13 +118,13 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
final String str = ig.getUnlocalizedGroupName( u.getSupported().keySet(), j.getKey() );
|
||||
if( str != null )
|
||||
{
|
||||
name = Platform.gui_localize( str ) + ( limit > 1 ? " (" + limit + ')' : "" );
|
||||
name = new TranslationTextComponent( str ).appendText( limit > 1 ? " (" + limit + ')' : "" );
|
||||
}
|
||||
}
|
||||
|
||||
if( name == null )
|
||||
{
|
||||
name = j.getKey().getDisplayName() + ( limit > 1 ? " (" + limit + ')' : "" );
|
||||
name = j.getKey().getDisplayName().appendText( ( limit > 1 ? " (" + limit + ')' : "" ) );
|
||||
}
|
||||
|
||||
if( !textList.contains( name ) )
|
||||
@@ -132,8 +134,9 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
}
|
||||
|
||||
final Pattern p = Pattern.compile( "(\\d+)[^\\d]" );
|
||||
// FIXME This comparison is not great...
|
||||
final SlightlyBetterSort s = new SlightlyBetterSort( p );
|
||||
Collections.sort( textList, s );
|
||||
textList.sort(s);
|
||||
lines.addAll( textList );
|
||||
}
|
||||
}
|
||||
@@ -206,8 +209,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
|
||||
{
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
final List<MaterialType> types = Arrays.asList( MaterialType.values() );
|
||||
Collections.sort( types, ( o1, o2 ) -> o1.name().compareTo( o2.name() ) );
|
||||
|
||||
@@ -215,7 +217,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
{
|
||||
if( mat.getDamageValue() >= 0 && mat.isRegistered() && mat.getItemInstance() == this )
|
||||
{
|
||||
itemStacks.add( new ItemStack( this, 1, mat.getDamageValue() ) );
|
||||
items.add( new ItemStack( this, 1/* FIXME, mat.getDamageValue() */ ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,7 +347,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class SlightlyBetterSort implements Comparator<String>
|
||||
private static class SlightlyBetterSort implements Comparator<ITextComponent>
|
||||
{
|
||||
private final Pattern pattern;
|
||||
|
||||
@@ -355,12 +357,12 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare( final String o1, final String o2 )
|
||||
public int compare( final ITextComponent o1, final ITextComponent o2 )
|
||||
{
|
||||
try
|
||||
{
|
||||
final Matcher a = this.pattern.matcher( o1 );
|
||||
final Matcher b = this.pattern.matcher( o2 );
|
||||
final Matcher a = this.pattern.matcher( o1.getString() );
|
||||
final Matcher b = this.pattern.matcher( o2.getString() );
|
||||
if( a.find() && b.find() )
|
||||
{
|
||||
final int ia = Integer.parseInt( a.group( 1 ) );
|
||||
@@ -372,7 +374,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
{
|
||||
// ek!
|
||||
}
|
||||
return o1.compareTo( o2 );
|
||||
return o1.getString().compareTo( o2.getString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.NonNullList;
|
||||
@@ -59,9 +59,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
public static final int FLUIX = SINGLE_OFFSET * 2;
|
||||
public static final int FINAL_STAGE = SINGLE_OFFSET * 3;
|
||||
|
||||
public ItemCrystalSeed()
|
||||
{
|
||||
this.setHasSubtypes( true );
|
||||
public ItemCrystalSeed(Properties properties) {
|
||||
super(properties);
|
||||
// FIXME this.setHasSubtypes( true );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -75,9 +75,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
.maybeStack( 1 )
|
||||
.map( crystalSeedStack ->
|
||||
{
|
||||
crystalSeedStack.setItemDamage( certus2 );
|
||||
// FIXME crystalSeedStack.setItemDamage( certus2 );
|
||||
crystalSeedStack = newStyle( crystalSeedStack );
|
||||
String itemName = crystalSeedStack.getItem().getRegistryName().getResourcePath();
|
||||
String itemName = crystalSeedStack.getItem().getRegistryName().getPath();
|
||||
return new ResolverResult( itemName, crystalSeedStack.getDamage(), crystalSeedStack.getTag() );
|
||||
} )
|
||||
.orElse( null );
|
||||
@@ -101,7 +101,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
final int progress;
|
||||
final CompoundNBT comp = is.getOrCreateTag();
|
||||
comp.putInt( "progress", progress = is.getDamage() );
|
||||
is.setItemDamage( ( is.getDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET );
|
||||
// FIXME is.setItemDamage( ( is.getDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET );
|
||||
return progress;
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
{
|
||||
final CompoundNBT comp = is.getOrCreateTag();
|
||||
comp.putInt( "progress", newDamage );
|
||||
is.setItemDamage( is.getDamage() / LEVEL_OFFSET * LEVEL_OFFSET );
|
||||
// FIXME is.setItemDamage( is.getDamage() / LEVEL_OFFSET * LEVEL_OFFSET );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -239,22 +239,21 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
|
||||
{
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
// lvl 0
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, CERTUS ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, NETHER ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, FLUIX ) ) );
|
||||
items.add( newStyle( new ItemStack( this, 1 /* FIXME , CERTUS */ ) ) );
|
||||
items.add( newStyle( new ItemStack( this, 1 /* FIXME , NETHER */ ) ) );
|
||||
items.add( newStyle( new ItemStack( this, 1 /* FIXME , FLUIX */ ) ) );
|
||||
|
||||
// lvl 1
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + CERTUS ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + NETHER ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET + FLUIX ) ) );
|
||||
items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET + CERTUS */ ) ) );
|
||||
items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET + NETHER */ ) ) );
|
||||
items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET + FLUIX */ ) ) );
|
||||
|
||||
// lvl 2
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + CERTUS ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + NETHER ) ) );
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + FLUIX ) ) );
|
||||
items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET * 2 + CERTUS */ ) ) );
|
||||
items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET * 2 + NETHER */ ) ) );
|
||||
items.add( newStyle( new ItemStack( this, 1 /* FIXME , LEVEL_OFFSET * 2 + FLUIX */ ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package appeng.items.misc;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -55,49 +54,49 @@ public class ItemCrystalSeedRendering extends ItemRenderingCustomizer
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.variants( ImmutableList.<ResourceLocation>builder().add( MODELS_CERTUS ).add( MODELS_FLUIX ).add( MODELS_NETHER ).build() );
|
||||
rendering.meshDefinition( this.getItemMeshDefinition() );
|
||||
// FIXME rendering.meshDefinition( this.getItemMeshDefinition() );
|
||||
}
|
||||
|
||||
private ItemMeshDefinition getItemMeshDefinition()
|
||||
{
|
||||
return is ->
|
||||
{
|
||||
int damage = ItemCrystalSeed.getProgress( is );
|
||||
|
||||
// Split the damage value into crystal type and growth level
|
||||
int type = damage / ItemCrystalSeed.SINGLE_OFFSET;
|
||||
int level = ( damage % ItemCrystalSeed.SINGLE_OFFSET ) / ItemCrystalSeed.LEVEL_OFFSET;
|
||||
|
||||
// Determine which list of models to use based on the type of crystal
|
||||
ModelResourceLocation[] models;
|
||||
switch( type )
|
||||
{
|
||||
case 0:
|
||||
models = MODELS_CERTUS;
|
||||
break;
|
||||
case 1:
|
||||
models = MODELS_NETHER;
|
||||
break;
|
||||
case 2:
|
||||
models = MODELS_FLUIX;
|
||||
break;
|
||||
default:
|
||||
// We use this as the fallback for broken items
|
||||
models = MODELS_CERTUS;
|
||||
break;
|
||||
}
|
||||
|
||||
// Return one of the 3 models based on the level
|
||||
if( level < 0 )
|
||||
{
|
||||
level = 0;
|
||||
}
|
||||
else if( level >= models.length )
|
||||
{
|
||||
level = models.length - 1;
|
||||
}
|
||||
|
||||
return models[level];
|
||||
};
|
||||
}
|
||||
// FIXME private ItemMeshDefinition getItemMeshDefinition()
|
||||
// FIXME {
|
||||
// FIXME return is ->
|
||||
// FIXME {
|
||||
// FIXME int damage = ItemCrystalSeed.getProgress( is );
|
||||
// FIXME
|
||||
// FIXME // Split the damage value into crystal type and growth level
|
||||
// FIXME int type = damage / ItemCrystalSeed.SINGLE_OFFSET;
|
||||
// FIXME int level = ( damage % ItemCrystalSeed.SINGLE_OFFSET ) / ItemCrystalSeed.LEVEL_OFFSET;
|
||||
// FIXME
|
||||
// FIXME // Determine which list of models to use based on the type of crystal
|
||||
// FIXME ModelResourceLocation[] models;
|
||||
// FIXME switch( type )
|
||||
// FIXME {
|
||||
// FIXME case 0:
|
||||
// FIXME models = MODELS_CERTUS;
|
||||
// FIXME break;
|
||||
// FIXME case 1:
|
||||
// FIXME models = MODELS_NETHER;
|
||||
// FIXME break;
|
||||
// FIXME case 2:
|
||||
// FIXME models = MODELS_FLUIX;
|
||||
// FIXME break;
|
||||
// FIXME default:
|
||||
// FIXME // We use this as the fallback for broken items
|
||||
// FIXME models = MODELS_CERTUS;
|
||||
// FIXME break;
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME // Return one of the 3 models based on the level
|
||||
// FIXME if( level < 0 )
|
||||
// FIXME {
|
||||
// FIXME level = 0;
|
||||
// FIXME }
|
||||
// FIXME else if( level >= models.length )
|
||||
// FIXME {
|
||||
// FIXME level = models.length - 1;
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME return models[level];
|
||||
// FIXME };
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
@@ -19,25 +19,6 @@
|
||||
package appeng.items.misc;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.implementations.ICraftingPatternItem;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -48,6 +29,26 @@ import appeng.helpers.InvalidPatternHelper;
|
||||
import appeng.helpers.PatternHelper;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
|
||||
public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternItem
|
||||
@@ -115,34 +116,35 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
return;
|
||||
}
|
||||
|
||||
stack.setStackDisplayName( TextFormatting.RED + GuiText.InvalidPattern.getLocal() );
|
||||
stack.setDisplayName(new TranslationTextComponent(GuiText.InvalidPattern.getTranslationKey())
|
||||
.applyTextStyle(TextFormatting.RED));
|
||||
|
||||
InvalidPatternHelper invalid = new InvalidPatternHelper( stack );
|
||||
|
||||
final String label = ( invalid.isCraftable() ? GuiText.Crafts.getLocal() : GuiText.Creates.getLocal() ) + ": ";
|
||||
final String and = ' ' + GuiText.And.getLocal() + ' ';
|
||||
final String with = GuiText.With.getLocal() + ": ";
|
||||
final ITextComponent label = new TranslationTextComponent( invalid.isCraftable() ? GuiText.Crafts.getTranslationKey() : GuiText.Creates.getTranslationKey() ).appendText(": ");
|
||||
final ITextComponent and = new StringTextComponent(" ").appendSibling(new TranslationTextComponent(GuiText.And.getTranslationKey())).appendText(" ");
|
||||
final ITextComponent with = new TranslationTextComponent(GuiText.With.getTranslationKey()).appendText(": ");
|
||||
|
||||
boolean first = true;
|
||||
for( final InvalidPatternHelper.PatternIngredient output : invalid.getOutputs() )
|
||||
{
|
||||
lines.add( ( first ? label : and ) + output.getFormattedToolTip() );
|
||||
lines.add( ( first ? label : and ).shallowCopy().appendSibling(output.getFormattedToolTip()) );
|
||||
first = false;
|
||||
}
|
||||
|
||||
first = true;
|
||||
for( final InvalidPatternHelper.PatternIngredient input : invalid.getInputs() )
|
||||
{
|
||||
lines.add( ( first ? with : and ) + input.getFormattedToolTip() );
|
||||
lines.add( ( first ? with : and ).shallowCopy().appendSibling(input.getFormattedToolTip()) );
|
||||
first = false;
|
||||
}
|
||||
|
||||
if( invalid.isCraftable() )
|
||||
{
|
||||
final String substitutionLabel = GuiText.Substitute.getLocal() + " ";
|
||||
final String canSubstitute = invalid.canSubstitute() ? GuiText.Yes.getLocal() : GuiText.No.getLocal();
|
||||
final ITextComponent substitutionLabel = new TranslationTextComponent(GuiText.Substitute.getTranslationKey()).appendText(" ");
|
||||
final ITextComponent canSubstitute = new TranslationTextComponent(invalid.canSubstitute() ? GuiText.Yes.getTranslationKey() : GuiText.No.getTranslationKey());
|
||||
|
||||
lines.add( substitutionLabel + canSubstitute );
|
||||
lines.add( substitutionLabel.appendSibling(canSubstitute) );
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -159,9 +161,9 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
final IAEItemStack[] in = details.getCondensedInputs();
|
||||
final IAEItemStack[] out = details.getCondensedOutputs();
|
||||
|
||||
final String label = ( isCrafting ? GuiText.Crafts.getLocal() : GuiText.Creates.getLocal() ) + ": ";
|
||||
final String and = ' ' + GuiText.And.getLocal() + ' ';
|
||||
final String with = GuiText.With.getLocal() + ": ";
|
||||
final ITextComponent label = ( isCrafting ? GuiText.Crafts.textComponent() : GuiText.Creates.textComponent() ).appendText(": ");
|
||||
final ITextComponent and = new StringTextComponent(" ").appendSibling(GuiText.And.textComponent()).appendText(" ");
|
||||
final ITextComponent with = GuiText.With.textComponent().appendText(": ");
|
||||
|
||||
boolean first = true;
|
||||
for( final IAEItemStack anOut : out )
|
||||
@@ -171,7 +173,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
continue;
|
||||
}
|
||||
|
||||
lines.add( ( first ? label : and ) + anOut.getStackSize() + ' ' + Platform.getItemDisplayName( anOut ) );
|
||||
lines.add( ( first ? label : and ).shallowCopy().appendText(anOut.getStackSize() + " ").appendSibling(Platform.getItemDisplayName( anOut )));
|
||||
first = false;
|
||||
}
|
||||
|
||||
@@ -183,16 +185,16 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
continue;
|
||||
}
|
||||
|
||||
lines.add( ( first ? with : and ) + anIn.getStackSize() + ' ' + Platform.getItemDisplayName( anIn ) );
|
||||
lines.add((first ? with : and).shallowCopy().appendText(anIn.getStackSize() + " ").appendSibling(Platform.getItemDisplayName(anIn)));
|
||||
first = false;
|
||||
}
|
||||
|
||||
if( isCrafting )
|
||||
{
|
||||
final String substitutionLabel = GuiText.Substitute.getLocal() + " ";
|
||||
final String canSubstitute = substitute ? GuiText.Yes.getLocal() : GuiText.No.getLocal();
|
||||
final ITextComponent substitutionLabel = GuiText.Substitute.textComponent().appendText(" ");
|
||||
final ITextComponent canSubstitute = substitute ? GuiText.Yes.textComponent() : GuiText.No.textComponent();
|
||||
|
||||
lines.add( substitutionLabel + canSubstitute );
|
||||
lines.add( substitutionLabel.appendSibling(canSubstitute) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@ public class ItemPaintBall extends AEBaseItem
|
||||
|
||||
private static final int DAMAGE_THRESHOLD = 20;
|
||||
|
||||
public ItemPaintBall()
|
||||
{
|
||||
this.setHasSubtypes( true );
|
||||
public ItemPaintBall(Properties properties) {
|
||||
super(properties);
|
||||
// FIXME this.setHasSubtypes( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,7 +84,7 @@ public class ItemPaintBall extends AEBaseItem
|
||||
{
|
||||
if( c != AEColor.TRANSPARENT )
|
||||
{
|
||||
itemStacks.add( new ItemStack( this, 1, c.ordinal() ) );
|
||||
itemStacks.add( new ItemStack( this, 1 /* FIXME, c.ordinal() */ ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ItemPaintBall extends AEBaseItem
|
||||
{
|
||||
if( c != AEColor.TRANSPARENT )
|
||||
{
|
||||
itemStacks.add( new ItemStack( this, 1, DAMAGE_THRESHOLD + c.ordinal() ) );
|
||||
itemStacks.add( new ItemStack( this, 1 /* FIXME , DAMAGE_THRESHOLD + c.ordinal() */ ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ItemPaintBallRendering extends ItemRenderingCustomizer
|
||||
{
|
||||
rendering.color( ItemPaintBallRendering::getColorFromItemstack );
|
||||
rendering.variants( MODEL_NORMAL, MODEL_SHIMMER );
|
||||
rendering.meshDefinition( is -> ItemPaintBall.isLumen( is ) ? MODEL_SHIMMER : MODEL_NORMAL );
|
||||
// FIXME rendering.meshDefinition( is -> ItemPaintBall.isLumen( is ) ? MODEL_SHIMMER : MODEL_NORMAL );
|
||||
}
|
||||
|
||||
private static int getColorFromItemstack( ItemStack stack, int tintIndex )
|
||||
|
||||
@@ -21,7 +21,6 @@ package appeng.items.parts;
|
||||
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
import appeng.client.render.FacadeItemModel;
|
||||
|
||||
|
||||
/**
|
||||
@@ -34,6 +33,6 @@ public class FacadeRendering extends ItemRenderingCustomizer
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
// This actually just uses the path it will look for by default, no custom model redirection needed
|
||||
rendering.builtInModel( "models/item/facade", new FacadeItemModel() );
|
||||
// FIXME rendering.builtInModel( "models/item/facade", new FacadeItemModel() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,30 +25,18 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.BlockRenderType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinitionException;
|
||||
import appeng.api.parts.IAlphaPassItem;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -67,9 +55,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
|
||||
private List<ItemStack> subTypes = null;
|
||||
|
||||
public ItemFacade()
|
||||
{
|
||||
this.setHasSubtypes( true );
|
||||
public ItemFacade(Properties properties) {
|
||||
super(properties);
|
||||
// FIXME this.setHasSubtypes( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,10 +85,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
|
||||
{
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
this.calculateSubTypes();
|
||||
itemStacks.addAll( this.subTypes );
|
||||
items.addAll( this.subTypes );
|
||||
}
|
||||
|
||||
private void calculateSubTypes()
|
||||
@@ -118,14 +105,15 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
continue;
|
||||
}
|
||||
|
||||
final NonNullList<ItemStack> tmpList = NonNullList.create();
|
||||
b.getSubBlocks( b.getCreativeTabToDisplayOn(), tmpList );
|
||||
for( final ItemStack l : tmpList )
|
||||
{
|
||||
final ItemStack facade = this.createFacadeForItem( l, false );
|
||||
if( !facade.isEmpty() )
|
||||
{
|
||||
this.subTypes.add( facade );
|
||||
Item blockItem = b.asItem();
|
||||
if (blockItem != null && blockItem.getGroup() != null) {
|
||||
final NonNullList<ItemStack> tmpList = NonNullList.create();
|
||||
b.fillItemGroup(blockItem.getGroup(), tmpList);
|
||||
for (final ItemStack l : tmpList) {
|
||||
final ItemStack facade = this.createFacadeForItem(l, false);
|
||||
if (!facade.isEmpty()) {
|
||||
this.subTypes.add(facade);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,14 +138,14 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
final int metadata = itemStack.getItem().getMetadata( itemStack.getDamage() );
|
||||
final int metadata = 0; // FIXME itemStack.getItem().getMetadata( itemStack.getDamage() );
|
||||
|
||||
// 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 = block.getStateFromMeta( metadata );
|
||||
blockState = null; // FIXME block.getStateFromMeta( metadata );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
@@ -171,7 +159,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
|
||||
final BlockState defaultState = block.getDefaultState();
|
||||
final boolean isTileEntity = block.hasTileEntity( defaultState );
|
||||
final boolean isFullCube = block.isFullCube( defaultState );
|
||||
final boolean isFullCube = true; // FIXME defaultState.isFullCube( defaultState );
|
||||
|
||||
final boolean isTileEntityAllowed = !isTileEntity || ( areTileEntitiesEnabled && isWhiteListed );
|
||||
final boolean isBlockAllowed = isFullCube || isWhiteListed;
|
||||
@@ -267,11 +255,11 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
return Blocks.GLASS.getDefaultState();
|
||||
}
|
||||
|
||||
int metadata = baseItemStack.getItem().getMetadata( baseItemStack );
|
||||
int metadata = 0; // FIXME baseItemStack.getItem().getMetadata( baseItemStack );
|
||||
|
||||
try
|
||||
{
|
||||
return block.getStateFromMeta( metadata );
|
||||
return null; // FIXME block.getStateFromMeta( metadata );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
@@ -329,7 +317,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
return false;
|
||||
}
|
||||
|
||||
Block blk = blockState.getBlock();
|
||||
return blk.canRenderInLayer( blockState, BlockRenderLayer.TRANSLUCENT );
|
||||
return RenderTypeLookup.canRenderInLayer( blockState, RenderType.getTranslucent() )
|
||||
|| RenderTypeLookup.canRenderInLayer( blockState, RenderType.getTranslucentNoCrumbling() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,34 +19,6 @@
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.items.IItemGroup;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartItem;
|
||||
@@ -56,6 +28,21 @@ import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
|
||||
public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
@@ -66,11 +53,11 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
public static ItemPart instance;
|
||||
private final Map<Integer, PartTypeWithVariant> registered;
|
||||
|
||||
public ItemPart()
|
||||
{
|
||||
public ItemPart(Properties properties) {
|
||||
super(properties);
|
||||
this.registered = new HashMap<>( INITIAL_REGISTERED_CAPACITY );
|
||||
|
||||
this.setHasSubtypes( true );
|
||||
// FIXME this.setHasSubtypes( true );
|
||||
|
||||
instance = this;
|
||||
}
|
||||
@@ -113,7 +100,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
|
||||
final int partDamage = mat.getBaseDamage() + varID;
|
||||
final ActivityState state = ActivityState.from( enabled );
|
||||
final ItemStackSrc output = new ItemStackSrc( this, partDamage, state );
|
||||
final ItemStackSrc output = new ItemStackSrc( this/* FIXME, partDamage */, state );
|
||||
|
||||
final PartTypeWithVariant pti = new PartTypeWithVariant( mat, varID );
|
||||
|
||||
@@ -175,7 +162,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName( final ItemStack is )
|
||||
public ITextComponent getDisplayName(final ItemStack is )
|
||||
{
|
||||
final PartType pt = this.getTypeByStack( is );
|
||||
|
||||
@@ -187,27 +174,26 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
|
||||
if( registeredPartType != null )
|
||||
{
|
||||
return super.getItemStackDisplayName( is ) + " - " + variants[registeredPartType.variant].toString();
|
||||
return super.getDisplayName( is ).appendText(" - ").appendSibling(new TranslationTextComponent(variants[registeredPartType.variant].translationKey));
|
||||
}
|
||||
}
|
||||
|
||||
if( pt.getExtraName() != null )
|
||||
{
|
||||
return super.getItemStackDisplayName( is ) + " - " + pt.getExtraName().getLocal();
|
||||
return super.getDisplayName( is ).appendText(" - ").appendSibling(pt.getExtraName().textComponent());
|
||||
}
|
||||
|
||||
return super.getItemStackDisplayName( is );
|
||||
return super.getDisplayName( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
|
||||
{
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
final List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<>( this.registered.entrySet() );
|
||||
Collections.sort( types, REGISTERED_COMPARATOR );
|
||||
|
||||
for( final Entry<Integer, PartTypeWithVariant> part : types )
|
||||
{
|
||||
itemStacks.add( new ItemStack( this, 1, part.getKey() ) );
|
||||
items.add( new ItemStack( this, 1/* FIXME, part.getKey() */ ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,8 +213,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IPart createPartFromItemStack( final ItemStack is )
|
||||
{
|
||||
public IPart createPartFromItemStack( final ItemStack is ) {
|
||||
final PartType type = this.getTypeByStack( is );
|
||||
final Class<? extends IPart> part = type.getPart();
|
||||
if( part == null )
|
||||
@@ -245,22 +230,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
|
||||
return type.getConstructor().newInstance( is );
|
||||
}
|
||||
catch( final InstantiationException e )
|
||||
{
|
||||
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part
|
||||
.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
}
|
||||
catch( final IllegalAccessException e )
|
||||
{
|
||||
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part
|
||||
.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
}
|
||||
catch( final InvocationTargetException e )
|
||||
{
|
||||
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part
|
||||
.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
}
|
||||
catch( final NoSuchMethodException e )
|
||||
catch( final InstantiationException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e )
|
||||
{
|
||||
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part
|
||||
.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
@@ -332,11 +302,11 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
|
||||
if( group && importBus && exportBus && ( u == PartType.IMPORT_BUS || u == PartType.EXPORT_BUS ) )
|
||||
{
|
||||
return GuiText.IOBuses.getUnlocalized();
|
||||
return GuiText.IOBuses.getTranslationKey();
|
||||
}
|
||||
if( group && importBusFluids && exportBusFluids && ( u == PartType.FLUID_IMPORT_BUS || u == PartType.FLUID_EXPORT_BUS ) )
|
||||
{
|
||||
return GuiText.IOBusesFluids.getUnlocalized();
|
||||
return GuiText.IOBusesFluids.getTranslationKey();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -34,7 +34,6 @@ import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
import appeng.client.render.StaticItemColor;
|
||||
import appeng.client.render.cablebus.P2PTunnelFrequencyModel;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.parts.automation.PlaneConnections;
|
||||
@@ -59,7 +58,7 @@ public class ItemPartRendering extends ItemRenderingCustomizer
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
|
||||
rendering.meshDefinition( this::getItemMeshDefinition );
|
||||
// FIXME rendering.meshDefinition( this::getItemMeshDefinition );
|
||||
|
||||
rendering.color( new StaticItemColor( AEColor.TRANSPARENT ) );
|
||||
|
||||
@@ -130,7 +129,7 @@ public class ItemPartRendering extends ItemRenderingCustomizer
|
||||
}
|
||||
|
||||
// base p2p model with frequency
|
||||
rendering.builtInModel( "models/part/builtin/p2p_tunnel_frequency", new P2PTunnelFrequencyModel() );
|
||||
// FIXME rendering.builtInModel( "models/part/builtin/p2p_tunnel_frequency", new P2PTunnelFrequencyModel() );
|
||||
|
||||
List<ResourceLocation> partResourceLocs = modelNames.stream()
|
||||
.map( name -> new ResourceLocation( AppEng.MOD_ID, name ) )
|
||||
|
||||
@@ -41,16 +41,6 @@ import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.fluids.parts.PartFluidAnnihilationPlane;
|
||||
import appeng.fluids.parts.PartFluidExportBus;
|
||||
import appeng.fluids.parts.PartFluidFormationPlane;
|
||||
import appeng.fluids.parts.PartFluidImportBus;
|
||||
import appeng.fluids.parts.PartFluidInterface;
|
||||
import appeng.fluids.parts.PartFluidLevelEmitter;
|
||||
import appeng.fluids.parts.PartFluidStorageBus;
|
||||
import appeng.fluids.parts.PartFluidTerminal;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.parts.automation.PartAnnihilationPlane;
|
||||
import appeng.parts.automation.PartExportBus;
|
||||
import appeng.parts.automation.PartFormationPlane;
|
||||
@@ -69,9 +59,6 @@ import appeng.parts.networking.PartDenseCableCovered;
|
||||
import appeng.parts.networking.PartDenseCableSmart;
|
||||
import appeng.parts.networking.PartQuartzFiber;
|
||||
import appeng.parts.p2p.PartP2PFEPower;
|
||||
import appeng.parts.p2p.PartP2PFluids;
|
||||
import appeng.parts.p2p.PartP2PIC2Power;
|
||||
import appeng.parts.p2p.PartP2PItems;
|
||||
import appeng.parts.p2p.PartP2PLight;
|
||||
import appeng.parts.p2p.PartP2PRedstone;
|
||||
import appeng.parts.p2p.PartP2PTunnelME;
|
||||
@@ -199,20 +186,20 @@ public enum PartType
|
||||
DARK_MONITOR( 200, "dark_monitor", EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class, "itemIlluminatedPanel" ),
|
||||
|
||||
STORAGE_BUS( 220, "storage_bus", EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
|
||||
FLUID_STORAGE_BUS( 221, "fluid_storage_bus", EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidStorageBus.class ),
|
||||
// FIXME FLUID_STORAGE_BUS( 221, "fluid_storage_bus", EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
|
||||
// FIXME .noneOf( IntegrationType.class ), PartFluidStorageBus.class ),
|
||||
|
||||
IMPORT_BUS( 240, "import_bus", EnumSet.of( AEFeature.IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartImportBus.class ),
|
||||
|
||||
FLUID_IMPORT_BUS( 241, "fluid_import_bus", EnumSet.of( AEFeature.FLUID_IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidImportBus.class ),
|
||||
// FIXME FLUID_IMPORT_BUS( 241, "fluid_import_bus", EnumSet.of( AEFeature.FLUID_IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidImportBus.class ),
|
||||
|
||||
EXPORT_BUS( 260, "export_bus", EnumSet.of( AEFeature.EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartExportBus.class ),
|
||||
|
||||
FLUID_EXPORT_BUS( 261, "fluid_export_bus", EnumSet.of( AEFeature.FLUID_EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidExportBus.class ),
|
||||
// FIXME FLUID_EXPORT_BUS( 261, "fluid_export_bus", EnumSet.of( AEFeature.FLUID_EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidExportBus.class ),
|
||||
|
||||
LEVEL_EMITTER( 280, "level_emitter", EnumSet.of( AEFeature.LEVEL_EMITTER ), EnumSet.noneOf( IntegrationType.class ), PartLevelEmitter.class ),
|
||||
FLUID_LEVEL_EMITTER( 281, "fluid_level_emitter", EnumSet.of( AEFeature.FLUID_LEVEL_EMITTER ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidLevelEmitter.class ),
|
||||
// FIXME FLUID_LEVEL_EMITTER( 281, "fluid_level_emitter", EnumSet.of( AEFeature.FLUID_LEVEL_EMITTER ), EnumSet
|
||||
// FIXME .noneOf( IntegrationType.class ), PartFluidLevelEmitter.class ),
|
||||
|
||||
ANNIHILATION_PLANE( 300, "annihilation_plane", EnumSet.of( AEFeature.ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartAnnihilationPlane.class ),
|
||||
@@ -220,13 +207,13 @@ public enum PartType
|
||||
IDENTITY_ANNIHILATION_PLANE( 301, "identity_annihilation_plane", EnumSet.of( AEFeature.ANNIHILATION_PLANE, AEFeature.IDENTITY_ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartIdentityAnnihilationPlane.class ),
|
||||
|
||||
FLUID_ANNIHILATION_PLANE( 302, "fluid_annihilation_plane", EnumSet.of( AEFeature.FLUID_ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidAnnihilationPlane.class ),
|
||||
// FIXME FLUID_ANNIHILATION_PLANE( 302, "fluid_annihilation_plane", EnumSet.of( AEFeature.FLUID_ANNIHILATION_PLANE ), EnumSet
|
||||
// FIXME .noneOf( IntegrationType.class ), PartFluidAnnihilationPlane.class ),
|
||||
|
||||
FORMATION_PLANE( 320, "formation_plane", EnumSet.of( AEFeature.FORMATION_PLANE ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
|
||||
|
||||
FLUID_FORMATION_PLANE( 321, "fluid_formation_plane", EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidFormationPlane.class ),
|
||||
// FIXME FLUID_FORMATION_PLANE( 321, "fluid_formation_plane", EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet
|
||||
// FIXME .noneOf( IntegrationType.class ), PartFluidFormationPlane.class ),
|
||||
|
||||
PATTERN_TERMINAL( 340, "pattern_terminal", EnumSet.of( AEFeature.PATTERNS ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
|
||||
|
||||
@@ -241,7 +228,7 @@ public enum PartType
|
||||
.noneOf( IntegrationType.class ), PartConversionMonitor.class ),
|
||||
|
||||
INTERFACE( 440, "interface", EnumSet.of( AEFeature.INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartInterface.class ),
|
||||
FLUID_INTERFACE( 441, "fluid_interface", EnumSet.of( AEFeature.FLUID_INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartFluidInterface.class ),
|
||||
// FIXME FLUID_INTERFACE( 441, "fluid_interface", EnumSet.of( AEFeature.FLUID_INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartFluidInterface.class ),
|
||||
|
||||
P2P_TUNNEL_ME( 460, "p2p_tunnel_me", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ME ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel )
|
||||
@@ -263,35 +250,35 @@ public enum PartType
|
||||
}
|
||||
},
|
||||
|
||||
P2P_TUNNEL_ITEMS( 462, "p2p_tunnel_items", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
|
||||
P2P_TUNNEL_FLUIDS( 463, "p2p_tunnel_fluids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
|
||||
P2P_TUNNEL_IC2( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet
|
||||
.of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel )
|
||||
{
|
||||
@Override
|
||||
String getTranslationKey()
|
||||
{
|
||||
return "p2p_tunnel";
|
||||
}
|
||||
},
|
||||
// FIXME P2P_TUNNEL_ITEMS( 462, "p2p_tunnel_items", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS ), EnumSet
|
||||
// FIXME .noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel )
|
||||
// FIXME {
|
||||
// FIXME @Override
|
||||
// FIXME String getTranslationKey()
|
||||
// FIXME {
|
||||
// FIXME return "p2p_tunnel";
|
||||
// FIXME }
|
||||
// FIXME },
|
||||
// FIXME
|
||||
// FIXME P2P_TUNNEL_FLUIDS( 463, "p2p_tunnel_fluids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
|
||||
// FIXME .noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel )
|
||||
// FIXME {
|
||||
// FIXME @Override
|
||||
// FIXME String getTranslationKey()
|
||||
// FIXME {
|
||||
// FIXME return "p2p_tunnel";
|
||||
// FIXME }
|
||||
// FIXME },
|
||||
// FIXME
|
||||
// FIXME P2P_TUNNEL_IC2( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet
|
||||
// FIXME .of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel )
|
||||
// FIXME {
|
||||
// FIXME @Override
|
||||
// FIXME String getTranslationKey()
|
||||
// FIXME {
|
||||
// FIXME return "p2p_tunnel";
|
||||
// FIXME }
|
||||
// FIXME },
|
||||
|
||||
P2P_TUNNEL_LIGHT( 467, "p2p_tunnel_light", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel )
|
||||
@@ -317,9 +304,9 @@ public enum PartType
|
||||
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
|
||||
|
||||
INTERFACE_TERMINAL( 480, "interface_terminal", EnumSet.of( AEFeature.INTERFACE_TERMINAL ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartInterfaceTerminal.class ),
|
||||
.noneOf( IntegrationType.class ), PartInterfaceTerminal.class );
|
||||
|
||||
FLUID_TERMINAL( 520, "fluid_terminal", EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class );
|
||||
// FIXME FLUID_TERMINAL( 520, "fluid_terminal", EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class );
|
||||
|
||||
private final int baseDamage;
|
||||
private final Set<AEFeature> features;
|
||||
@@ -358,8 +345,8 @@ public enum PartType
|
||||
this.oreName = oreDict;
|
||||
|
||||
// The part is enabled if all features + integrations it needs are enabled
|
||||
this.enabled = features.stream().allMatch( AEConfig.instance()::isFeatureEnabled ) && integrations.stream()
|
||||
.allMatch( IntegrationRegistry.INSTANCE::isEnabled );
|
||||
this.enabled = features.stream().allMatch( AEConfig.instance()::isFeatureEnabled ); /* FIXME && integrations.stream()
|
||||
.allMatch( IntegrationRegistry.INSTANCE::isEnabled ); */
|
||||
|
||||
if( this.enabled )
|
||||
{
|
||||
@@ -467,3 +454,5 @@ public enum PartType
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum IntegrationType {}
|
||||
@@ -29,7 +29,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -71,9 +71,9 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
|
||||
protected final MaterialType component;
|
||||
protected final int totalBytes;
|
||||
|
||||
public AbstractStorageCell( final MaterialType whichCell, final int kilobytes )
|
||||
{
|
||||
this.setMaxStackSize( 1 );
|
||||
public AbstractStorageCell(Properties properties, final MaterialType whichCell, final int kilobytes ) {
|
||||
super(properties);
|
||||
// FIXME this.setMaxStackSize( 1 ); ---- see point of registration
|
||||
this.totalBytes = kilobytes * 1024;
|
||||
this.component = whichCell;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
|
||||
@Override
|
||||
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
|
||||
{
|
||||
return GuiText.StorageCells.getUnlocalized();
|
||||
return GuiText.StorageCells.getTranslationKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,9 +37,9 @@ public final class BasicItemStorageCell extends AbstractStorageCell<IAEItemStack
|
||||
protected final int perType;
|
||||
protected final double idleDrain;
|
||||
|
||||
public BasicItemStorageCell( final MaterialType whichCell, final int kilobytes )
|
||||
public BasicItemStorageCell( Properties props, final MaterialType whichCell, final int kilobytes )
|
||||
{
|
||||
super( whichCell, kilobytes );
|
||||
super( props, whichCell, kilobytes );
|
||||
switch( whichCell )
|
||||
{
|
||||
case CELL1K_PART:
|
||||
|
||||
@@ -43,9 +43,10 @@ import appeng.items.contents.CellConfig;
|
||||
public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
{
|
||||
|
||||
public ItemCreativeStorageCell()
|
||||
public ItemCreativeStorageCell(Properties props)
|
||||
{
|
||||
this.setMaxStackSize( 1 );
|
||||
super(props);
|
||||
// FIXME this.setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,7 +39,7 @@ import appeng.capabilities.Capabilities;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.spatial.StorageHelper;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
|
||||
public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorageCell
|
||||
@@ -51,9 +51,10 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
|
||||
private final int maxRegion;
|
||||
|
||||
public ItemSpatialStorageCell( final int spatialScale )
|
||||
public ItemSpatialStorageCell( Properties props, final int spatialScale )
|
||||
{
|
||||
this.setMaxStackSize( 1 );
|
||||
super(props);
|
||||
// FIXME this.setMaxStackSize( 1 );
|
||||
this.maxRegion = spatialScale;
|
||||
}
|
||||
|
||||
@@ -64,13 +65,13 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
final int id = this.getStoredDimensionID( stack );
|
||||
if( id >= 0 )
|
||||
{
|
||||
lines.add( GuiText.CellId.getLocal() + ": " + id );
|
||||
lines.add( GuiText.CellId.textComponent().appendText( ": " + id ) );
|
||||
}
|
||||
|
||||
final WorldCoord wc = this.getStoredSize( stack );
|
||||
if( wc.x > 0 )
|
||||
{
|
||||
lines.add( GuiText.StoredSize.getLocal() + ": " + wc.x + " x " + wc.y + " x " + wc.z );
|
||||
lines.add( GuiText.StoredSize.textComponent().appendText( ": " + wc.x + " x " + wc.y + " x " + wc.z ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,17 +90,19 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
@Override
|
||||
public ISpatialDimension getSpatialDimension()
|
||||
{
|
||||
final int id = AppEng.instance().getStorageDimensionID();
|
||||
World w = DimensionManager.getWorld( id );
|
||||
if( w == null )
|
||||
{
|
||||
DimensionManager.initDimension( id );
|
||||
w = DimensionManager.getWorld( id );
|
||||
}
|
||||
World w = null;
|
||||
// FIXME final int id = AppEng.instance().getStorageDimensionID();
|
||||
// FIXME World w = DimensionManager.getWorld( id );
|
||||
// FIXME if( w == null )
|
||||
// FIXME {
|
||||
// FIXME DimensionManager.initDimension( id );
|
||||
// FIXME w = DimensionManager.getWorld( id );
|
||||
// FIXME }
|
||||
|
||||
if( w != null && w.hasCapability( Capabilities.SPATIAL_DIMENSION, null ) )
|
||||
if( w != null )
|
||||
{
|
||||
return w.getCapability( Capabilities.SPATIAL_DIMENSION, null );
|
||||
LazyOptional<ISpatialDimension> spatialCap = w.getCapability(Capabilities.SPATIAL_DIMENSION, null);
|
||||
return spatialCap.orElse(null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -157,10 +160,10 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
BlockPos offset = manager.getCellDimensionOrigin( cellid );
|
||||
|
||||
this.setStorageCell( is, cellid, targetSize );
|
||||
StorageHelper.getInstance()
|
||||
.swapRegions( w, min.x + 1, min.y + 1, min.z + 1, manager.getWorld(), offset.getX(), offset.getY(),
|
||||
offset.getZ(), targetX - 1, targetY - 1,
|
||||
targetZ - 1 );
|
||||
// FIXME StorageHelper.getInstance()
|
||||
// FIXME .swapRegions( w, min.x + 1, min.y + 1, min.z + 1, manager.getWorld(), offset.getX(), offset.getY(),
|
||||
// FIXME offset.getZ(), targetX - 1, targetY - 1,
|
||||
// FIXME targetZ - 1 );
|
||||
|
||||
return new TransitionResult( true, 0 );
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
import appeng.client.render.model.BiometricCardModel;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
@@ -21,7 +20,7 @@ public class ToolBiometricCardRendering extends ItemRenderingCustomizer
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.builtInModel( "models/item/builtin/biometric_card", new BiometricCardModel() );
|
||||
// FIXME rendering.builtInModel( "models/item/builtin/biometric_card", new BiometricCardModel() );
|
||||
rendering.model( new ModelResourceLocation( MODEL, "inventory" ) ).variants( MODEL );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -70,12 +71,14 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addInformation( final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
|
||||
String firstLineKey = this.getFirstValidTranslationKey( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) );
|
||||
lines.add( new TranslationTextComponent(firstLineKey));
|
||||
|
||||
final CompoundNBT data = this.getData( stack );
|
||||
if( data.contains( "tooltip" ) )
|
||||
{
|
||||
lines.add( I18n.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) );
|
||||
String tooltipKey = getFirstValidTranslationKey( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) );
|
||||
lines.add( new TranslationTextComponent(tooltipKey) );
|
||||
}
|
||||
|
||||
if( data.contains( "freq" ) )
|
||||
@@ -83,7 +86,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
final short freq = data.getShort( "freq" );
|
||||
final String freqTooltip = TextFormatting.BOLD + Platform.p2p().toHexString( freq );
|
||||
|
||||
lines.add( I18n.translateToLocalFormatted( "gui.tooltips.appliedenergistics2.P2PFrequency", freqTooltip ) );
|
||||
lines.add( new TranslationTextComponent( "gui.tooltips.appliedenergistics2.P2PFrequency", freqTooltip ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,14 +97,13 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
*
|
||||
* @return localized name
|
||||
*/
|
||||
private String getLocalizedName( final String... name )
|
||||
private String getFirstValidTranslationKey( final String... name )
|
||||
{
|
||||
for( final String n : name )
|
||||
{
|
||||
final String l = I18n.translateToLocal( n );
|
||||
if( !l.equals( n ) )
|
||||
if( I18n.hasKey(n) )
|
||||
{
|
||||
return l;
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +128,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
{
|
||||
final CompoundNBT c = is.getOrCreateTag();
|
||||
final String name = c.getString( "Config" );
|
||||
return name == null || name.isEmpty() ? GuiText.Blank.getUnlocalized() : name;
|
||||
return name.isEmpty() ? GuiText.Blank.getTranslationKey() : name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,10 +136,6 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
{
|
||||
final CompoundNBT c = is.getOrCreateTag();
|
||||
CompoundNBT o = c.getCompound( "Data" );
|
||||
if( o == null )
|
||||
{
|
||||
o = new CompoundNBT();
|
||||
}
|
||||
return o.copy();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
import appeng.client.render.model.MemoryCardModel;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
@@ -21,7 +20,7 @@ public class ToolMemoryCardRendering extends ItemRenderingCustomizer
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.builtInModel( "models/item/builtin/memory_card", new MemoryCardModel() );
|
||||
// FIXME rendering.builtInModel( "models/item/builtin/memory_card", new MemoryCardModel() );
|
||||
rendering.model( new ModelResourceLocation( MODEL, "inventory" ) ).variants( MODEL );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,16 +20,15 @@ package appeng.items.tools;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
@@ -48,7 +47,7 @@ import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.INetworkToolAgent;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketClick;
|
||||
import appeng.items.AEBaseItem;
|
||||
@@ -90,12 +89,12 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst( ItemStack stack, ItemUseContext context )
|
||||
{
|
||||
final RayTraceResult mop = new RayTraceResult( new Vec3d( hitX, hitY, hitZ ), side, pos );
|
||||
final BlockRayTraceResult mop = new BlockRayTraceResult( context.getHitVec(), context.getFace(), context.getPos(), context.isInside() );
|
||||
final TileEntity te = context.getWorld().getTileEntity( context.getPos() );
|
||||
|
||||
if( te instanceof IPartHost )
|
||||
{
|
||||
final SelectedPart part = ( (IPartHost) te ).selectPart( mop.hitVec );
|
||||
final SelectedPart part = ( (IPartHost) te ).selectPart( mop.getHitVec() );
|
||||
|
||||
if( part.part != null || part.facade != null )
|
||||
{
|
||||
@@ -116,7 +115,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketClick( pos, side, hitX, hitY, hitZ, hand ) );
|
||||
NetworkHandler.instance().sendToServer( new PacketClick( context.getPos(), context.getFace(), context.getPos().getX(), context.getPos().getY(), context.getPos().getZ(), context.getHand() ) );
|
||||
}
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
@@ -137,15 +136,15 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
|
||||
return false;
|
||||
}
|
||||
|
||||
final Block b = w.getBlockState( pos ).getBlock();
|
||||
final BlockState bs = w.getBlockState( pos );
|
||||
if( !p.isCrouching() )
|
||||
{
|
||||
final TileEntity te = w.getTileEntity( pos );
|
||||
if( !( te instanceof IGridHost ) )
|
||||
{
|
||||
if( b.rotateBlock( w, pos, side ) )
|
||||
if( bs.rotate( w, pos, Rotation.CLOCKWISE_90 ) != bs )
|
||||
{
|
||||
b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), w, pos, Platform.AIR_BLOCK, null, false );
|
||||
bs.neighborChanged( w, pos, Platform.AIR_BLOCK, pos, false );
|
||||
p.swingArm( hand );
|
||||
return !w.isRemote;
|
||||
}
|
||||
@@ -163,23 +162,24 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
|
||||
|
||||
if( te instanceof IGridHost )
|
||||
{
|
||||
Platform.openGUI( p, te, AEPartLocation.fromFacing( side ), GuiBridge.GUI_NETWORK_STATUS );
|
||||
// FIXME Platform.openGUI( p, te, AEPartLocation.fromFacing( side ), GuiBridge.GUI_NETWORK_STATUS );
|
||||
}
|
||||
else
|
||||
{
|
||||
Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_NETWORK_TOOL );
|
||||
// FIXME Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_NETWORK_TOOL );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
b.onBlockActivated( w, pos, w.getBlockState( pos ), p, hand, side, hitX, hitY, hitZ );
|
||||
BlockRayTraceResult rtr = new BlockRayTraceResult(new Vec3d(hitX, hitY, hitZ), side, pos, false);
|
||||
bs.onBlockActivated( w, p, hand, rtr );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_NETWORK_TOOL );
|
||||
// FIXME Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_NETWORK_TOOL );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -19,41 +19,6 @@
|
||||
package appeng.items.tools.powered;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.SnowballItem;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.block.BlockStainedGlass;
|
||||
import net.minecraft.block.BlockStainedGlassPane;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemSnowball;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.implementations.items.IItemGroup;
|
||||
@@ -82,6 +47,27 @@ import appeng.me.helpers.BaseActionSource;
|
||||
import appeng.tile.misc.TilePaint;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.SnowballItem;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCell<IAEItemStack>, IItemGroup, IBlockTool, IMouseWheelItem
|
||||
@@ -95,9 +81,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
final String dyeName = color.dye.getTranslationKey();
|
||||
final String oreDictName = "dye" + WordUtils.capitalize( dyeName );
|
||||
final int oreDictId = OreDictionary.getOreID( oreDictName );
|
||||
// FIXME final int oreDictId = OreDictionary.getOreID( oreDictName );
|
||||
|
||||
ORE_TO_COLOR.put( oreDictId, color );
|
||||
// FIXME ORE_TO_COLOR.put( oreDictId, color );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,18 +183,18 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName( final ItemStack par1ItemStack )
|
||||
public ITextComponent getDisplayName( final ItemStack is )
|
||||
{
|
||||
String extra = GuiText.Empty.getLocal();
|
||||
ITextComponent extra = GuiText.Empty.textComponent();
|
||||
|
||||
final AEColor selected = this.getActiveColor( par1ItemStack );
|
||||
final AEColor selected = this.getActiveColor( is );
|
||||
|
||||
if( selected != null && Platform.isClient() )
|
||||
{
|
||||
extra = Platform.gui_localize( selected.translationKey);
|
||||
extra = new TranslationTextComponent(selected.translationKey);
|
||||
}
|
||||
|
||||
return super.getItemStackDisplayName( par1ItemStack ) + " - " + extra;
|
||||
return super.getDisplayName( is ).appendText(" - ").appendSibling( extra );
|
||||
}
|
||||
|
||||
public AEColor getActiveColor( final ItemStack tol )
|
||||
@@ -235,15 +221,15 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
else
|
||||
{
|
||||
final int[] id = OreDictionary.getOreIDs( paintBall );
|
||||
|
||||
for( final int oreID : id )
|
||||
{
|
||||
if( ORE_TO_COLOR.containsKey( oreID ) )
|
||||
{
|
||||
return ORE_TO_COLOR.get( oreID );
|
||||
}
|
||||
}
|
||||
// FIXME final int[] id = OreDictionary.getOreIDs( paintBall );
|
||||
// FIXME
|
||||
// FIXME for( final int oreID : id )
|
||||
// FIXME {
|
||||
// FIXME if( ORE_TO_COLOR.containsKey( oreID ) )
|
||||
// FIXME {
|
||||
// FIXME return ORE_TO_COLOR.get( oreID );
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -353,63 +339,63 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
final BlockState state = w.getBlockState( pos );
|
||||
|
||||
if( blk instanceof BlockColored )
|
||||
{
|
||||
final EnumDyeColor color = state.getValue( BlockColored.COLOR );
|
||||
// FIXME if( blk instanceof BlockColored )
|
||||
// FIXME {
|
||||
// FIXME final DyeColor color = state.get( BlockColored.COLOR );
|
||||
// FIXME
|
||||
// FIXME if( newColor.dye == color )
|
||||
// FIXME {
|
||||
// FIXME return false;
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME return w.setBlockState( pos, state.with( BlockColored.COLOR, newColor.dye ) );
|
||||
// FIXME }
|
||||
|
||||
if( newColor.dye == color )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// if( blk == Blocks.GLASS )
|
||||
// {
|
||||
// return w.setBlockState( pos, Blocks.STAINED_GLASS.getDefaultState().with( BlockStainedGlass.COLOR, newColor.dye ) );
|
||||
// }
|
||||
//
|
||||
// if( blk == Blocks.STAINED_GLASS )
|
||||
// {
|
||||
// final DyeColor color = state.get( BlockStainedGlass.COLOR );
|
||||
//
|
||||
// if( newColor.dye == color )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return w.setBlockState( pos, state.with( BlockStainedGlass.COLOR, newColor.dye ) );
|
||||
// }
|
||||
|
||||
return w.setBlockState( pos, state.with( BlockColored.COLOR, newColor.dye ) );
|
||||
}
|
||||
|
||||
if( blk == Blocks.GLASS )
|
||||
{
|
||||
return w.setBlockState( pos, Blocks.STAINED_GLASS.getDefaultState().with( BlockStainedGlass.COLOR, newColor.dye ) );
|
||||
}
|
||||
|
||||
if( blk == Blocks.STAINED_GLASS )
|
||||
{
|
||||
final EnumDyeColor color = state.getValue( BlockStainedGlass.COLOR );
|
||||
|
||||
if( newColor.dye == color )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return w.setBlockState( pos, state.with( BlockStainedGlass.COLOR, newColor.dye ) );
|
||||
}
|
||||
|
||||
if( blk == Blocks.GLASS_PANE )
|
||||
{
|
||||
return w.setBlockState( pos, Blocks.STAINED_GLASS_PANE.getDefaultState().with( BlockStainedGlassPane.COLOR, newColor.dye ) );
|
||||
}
|
||||
|
||||
if( blk == Blocks.STAINED_GLASS_PANE )
|
||||
{
|
||||
final EnumDyeColor color = state.getValue( BlockStainedGlassPane.COLOR );
|
||||
|
||||
if( newColor.dye == color )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return w.setBlockState( pos, state.with( BlockStainedGlassPane.COLOR, newColor.dye ) );
|
||||
}
|
||||
|
||||
if( blk == Blocks.HARDENED_CLAY )
|
||||
{
|
||||
return w.setBlockState( pos, Blocks.STAINED_HARDENED_CLAY.getDefaultState().with( BlockColored.COLOR, newColor.dye ) );
|
||||
}
|
||||
// if( blk == Blocks.GLASS_PANE )
|
||||
// {
|
||||
// return w.setBlockState( pos, Blocks.STAINED_GLASS_PANE.getDefaultState().with( BlockStainedGlassPane.COLOR, newColor.dye ) );
|
||||
// }
|
||||
//
|
||||
// if( blk == Blocks.STAINED_GLASS_PANE )
|
||||
// {
|
||||
// final DyeColor color = state.get( BlockStainedGlassPane.COLOR );
|
||||
//
|
||||
// if( newColor.dye == color )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return w.setBlockState( pos, state.with( BlockStainedGlassPane.COLOR, newColor.dye ) );
|
||||
// }
|
||||
//
|
||||
// if( blk == Blocks.HARDENED_CLAY )
|
||||
// {
|
||||
// return w.setBlockState( pos, Blocks.STAINED_HARDENED_CLAY.getDefaultState().with( BlockColored.COLOR, newColor.dye ) );
|
||||
// }
|
||||
|
||||
if( blk instanceof BlockCableBus )
|
||||
{
|
||||
return ( (BlockCableBus) blk ).recolorBlock( w, pos, side, newColor.dye, p );
|
||||
}
|
||||
|
||||
return blk.recolorBlock( w, pos, side, newColor.dye );
|
||||
return blk.recolorBlock( state, w, pos, side, newColor.dye );
|
||||
}
|
||||
|
||||
public void cycleColors( final ItemStack is, final ItemStack paintBall, final int i )
|
||||
@@ -460,25 +446,25 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
@Override
|
||||
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
|
||||
{
|
||||
if( requestedAddition != null )
|
||||
{
|
||||
final int[] id = OreDictionary.getOreIDs( requestedAddition.getDefinition() );
|
||||
|
||||
for( final int x : id )
|
||||
{
|
||||
if( ORE_TO_COLOR.containsKey( x ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if( requestedAddition.getItem() instanceof SnowballItem )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return !( requestedAddition.getItem() instanceof ItemPaintBall && requestedAddition.getItemDamage() < 20 );
|
||||
}
|
||||
// FIXME if( requestedAddition != null )
|
||||
// FIXME {
|
||||
// FIXME final int[] id = OreDictionary.getOreIDs( requestedAddition.getDefinition() );
|
||||
// FIXME
|
||||
// FIXME for( final int x : id )
|
||||
// FIXME {
|
||||
// FIXME if( ORE_TO_COLOR.containsKey( x ) )
|
||||
// FIXME {
|
||||
// FIXME return false;
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME if( requestedAddition.getItem() instanceof SnowballItem )
|
||||
// FIXME {
|
||||
// FIXME return false;
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME return !( requestedAddition.getItem() instanceof ItemPaintBall && requestedAddition.getItemDamage() < 20 );
|
||||
// FIXME }
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -509,7 +495,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
@Override
|
||||
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
|
||||
{
|
||||
return GuiText.StorageCells.getUnlocalized();
|
||||
return GuiText.StorageCells.getTranslationKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
import appeng.client.render.model.ColorApplicatorModel;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
@@ -24,10 +23,10 @@ public class ToolColorApplicatorRendering extends ItemRenderingCustomizer
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.builtInModel( "models/item/builtin/color_applicator_colored", new ColorApplicatorModel() );
|
||||
// FIXME rendering.builtInModel( "models/item/builtin/color_applicator_colored", new ColorApplicatorModel() );
|
||||
rendering.variants( MODEL_COLORED, MODEL_UNCOLORED );
|
||||
rendering.color( this::getColor );
|
||||
rendering.meshDefinition( this::getMesh );
|
||||
// FIXME rendering.meshDefinition( this::getMesh );
|
||||
}
|
||||
|
||||
private ModelResourceLocation getMesh( ItemStack itemStack )
|
||||
|
||||
@@ -26,14 +26,13 @@ import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockTNT;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.TNTBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
@@ -41,6 +40,8 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -68,23 +69,23 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
|
||||
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.STONE.getDefaultState() ),
|
||||
new InWorldToolOperationResult( Blocks.COBBLESTONE.getDefaultState() ) );
|
||||
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.STONEBRICK.getDefaultState() ),
|
||||
new InWorldToolOperationResult( Blocks.STONEBRICK.getStateFromMeta( 2 ) ) );
|
||||
// FIXME this.coolDown.put( new InWorldToolOperationIngredient( Blocks.STONE_BRICKS.getDefaultState() ),
|
||||
// FIXME new InWorldToolOperationResult( Blocks.STONE_BRICKS.getStateFromMeta( 2 ) ) );
|
||||
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.LAVA, true ), new InWorldToolOperationResult( Blocks.OBSIDIAN.getDefaultState() ) );
|
||||
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_LAVA, true ),
|
||||
new InWorldToolOperationResult( Blocks.OBSIDIAN.getDefaultState() ) );
|
||||
// FIXME this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_LAVA, true ),
|
||||
// FIXME new InWorldToolOperationResult( Blocks.OBSIDIAN.getDefaultState() ) );
|
||||
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.GRASS, true ), new InWorldToolOperationResult( Blocks.DIRT.getDefaultState() ) );
|
||||
|
||||
final List<ItemStack> snowBalls = new ArrayList<>();
|
||||
snowBalls.add( new ItemStack( Items.SNOWBALL ) );
|
||||
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult( null, snowBalls ) );
|
||||
// FIXME this.coolDown.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult( null, snowBalls ) );
|
||||
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.WATER, true ), new InWorldToolOperationResult( Blocks.ICE.getDefaultState() ) );
|
||||
|
||||
this.heatUp.put( new InWorldToolOperationIngredient( Blocks.ICE.getDefaultState() ), new InWorldToolOperationResult( Blocks.WATER.getDefaultState() ) );
|
||||
this.heatUp.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult() );
|
||||
// FIXME this.heatUp.put( new InWorldToolOperationIngredient( Blocks.FLOWING_WATER, true ), new InWorldToolOperationResult() );
|
||||
this.heatUp.put( new InWorldToolOperationIngredient( Blocks.WATER, true ), new InWorldToolOperationResult() );
|
||||
this.heatUp.put( new InWorldToolOperationIngredient( Blocks.SNOW, true ),
|
||||
new InWorldToolOperationResult( Blocks.FLOWING_WATER.getStateFromMeta( 7 ) ) );
|
||||
// FIXME this.heatUp.put( new InWorldToolOperationIngredient( Blocks.SNOW, true ),
|
||||
// FIXME new InWorldToolOperationResult( Blocks.FLOWING_WATER.getStateFromMeta( 7 ) ) );
|
||||
}
|
||||
|
||||
private static class InWorldToolOperationIngredient
|
||||
@@ -213,28 +214,26 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity p, final Hand hand )
|
||||
{
|
||||
final RayTraceResult target = this.rayTrace( w, p, true );
|
||||
final RayTraceResult target = this.rayTrace( w, p, RayTraceContext.FluidMode.ANY );
|
||||
|
||||
if( target == null )
|
||||
if( target.getType() != RayTraceResult.Type.BLOCK )
|
||||
{
|
||||
return new ActionResult<>( ActionResultType.FAIL, p.getHeldItem( hand ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( target.getType() == RayTraceResult.Type.BLOCK )
|
||||
BlockPos pos = ((BlockRayTraceResult) target).getPos();
|
||||
final BlockState state = w.getBlockState( pos );
|
||||
if( state.getMaterial() == Material.LAVA || state.getMaterial() == Material.WATER )
|
||||
{
|
||||
final BlockState state = w.getBlockState( target.getBlockPos() );
|
||||
if( state.getMaterial() == Material.LAVA || state.getMaterial() == Material.WATER )
|
||||
if( Platform.hasPermissions( new DimensionalCoord( w, pos ), p ) )
|
||||
{
|
||||
if( Platform.hasPermissions( new DimensionalCoord( w, target.getBlockPos() ), p ) )
|
||||
{
|
||||
this.onItemUse( p, w, target.getBlockPos(), hand, Direction.UP, 0.0F, 0.0F, 0.0F );
|
||||
}
|
||||
this.onItemUse( p, w, pos, hand, Direction.UP, 0.0F, 0.0F, 0.0F );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
|
||||
return new ActionResult<>( ActionResultType.SUCCESS, p.getHeldItem( hand ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -244,13 +243,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult onItemUse( ItemStack item, PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
|
||||
public ActionResultType onItemUse( ItemStack item, PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
if( this.getAECurrentPower( item ) > 1600 )
|
||||
{
|
||||
if( !p.canPlayerEdit( pos, side, item ) )
|
||||
{
|
||||
return EnumActionResult.FAIL;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
final BlockState state = w.getBlockState( pos );
|
||||
@@ -262,30 +261,30 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
{
|
||||
this.extractAEPower( item, 1600, Actionable.MODULATE );
|
||||
this.cool( state, w, pos );
|
||||
return EnumActionResult.SUCCESS;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( blockID instanceof BlockTNT )
|
||||
if( blockID instanceof TNTBlock)
|
||||
{
|
||||
w.removeBlock(pos, false);
|
||||
( (BlockTNT) blockID ).explode( w, pos, state, p );
|
||||
return EnumActionResult.SUCCESS;
|
||||
( (TNTBlock) blockID ).explode( w, pos );
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
if( blockID instanceof BlockTinyTNT )
|
||||
{
|
||||
w.removeBlock(pos, false);
|
||||
( (BlockTinyTNT) blockID ).startFuse( w, pos, p );
|
||||
return EnumActionResult.SUCCESS;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
if( this.canHeat( state ) )
|
||||
{
|
||||
this.extractAEPower( item, 1600, Actionable.MODULATE );
|
||||
this.heat( state, w, pos );
|
||||
return EnumActionResult.SUCCESS;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
final ItemStack[] stack = Platform.getBlockDrops( w, pos );
|
||||
@@ -295,26 +294,26 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
|
||||
for( final ItemStack i : stack )
|
||||
{
|
||||
final ItemStack result = FurnaceRecipes.instance().getSmeltingResult( i );
|
||||
|
||||
if( !result.isEmpty() )
|
||||
{
|
||||
if( result.getItem() instanceof BlockItem )
|
||||
{
|
||||
if( Block.getBlockFromItem( result.getItem() ) == blockID && result.getItem().getDamage( result ) == blockID
|
||||
.getMetaFromState( state ) )
|
||||
{
|
||||
canFurnaceable = false;
|
||||
}
|
||||
}
|
||||
hasFurnaceable = true;
|
||||
out.add( result );
|
||||
}
|
||||
else
|
||||
{
|
||||
canFurnaceable = false;
|
||||
out.add( i );
|
||||
}
|
||||
// FIXME final ItemStack result = FurnaceRecipes.instance().getSmeltingResult( i );
|
||||
// FIXME
|
||||
// FIXME if( !result.isEmpty() )
|
||||
// FIXME {
|
||||
// FIXME if( result.getItem() instanceof BlockItem )
|
||||
// FIXME {
|
||||
// FIXME if( Block.getBlockFromItem( result.getItem() ) == blockID && result.getItem().getDamage( result ) == blockID
|
||||
// FIXME .getMetaFromState( state ) )
|
||||
// FIXME {
|
||||
// FIXME canFurnaceable = false;
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
// FIXME hasFurnaceable = true;
|
||||
// FIXME out.add( result );
|
||||
// FIXME }
|
||||
// FIXME else
|
||||
// FIXME {
|
||||
// FIXME canFurnaceable = false;
|
||||
// FIXME out.add( i );
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
if( hasFurnaceable && canFurnaceable )
|
||||
@@ -322,7 +321,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
this.extractAEPower( item, 1600, Actionable.MODULATE );
|
||||
final InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) );
|
||||
w.playSound( p, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 1.0F,
|
||||
itemRand.nextFloat() * 0.4F + 0.8F );
|
||||
random.nextFloat() * 0.4F + 0.8F );
|
||||
|
||||
if( or.getBlockState() == null )
|
||||
{
|
||||
@@ -338,7 +337,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
Platform.spawnDrops( w, pos, or.getDrops() );
|
||||
}
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -346,22 +345,22 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
|
||||
if( !p.canPlayerEdit( offsetPos, side, item ) )
|
||||
{
|
||||
return EnumActionResult.FAIL;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
if( w.isAirBlock( offsetPos ) )
|
||||
{
|
||||
this.extractAEPower( item, 1600, Actionable.MODULATE );
|
||||
w.playSound( p, offsetPos.getX() + 0.5D, offsetPos.getY() + 0.5D, offsetPos.getZ() + 0.5D, SoundEvents.ITEM_FLINTANDSTEEL_USE,
|
||||
SoundCategory.PLAYERS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
|
||||
SoundCategory.PLAYERS, 1.0F, random.nextFloat() * 0.4F + 0.8F );
|
||||
w.setBlockState( offsetPos, Blocks.FIRE.getDefaultState() );
|
||||
}
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EnumActionResult.PASS;
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,25 +22,17 @@ package appeng.items.tools.powered;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.entity.passive.SheepEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -186,6 +178,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
final AxisAlignedBB bb = new AxisAlignedBB( Math.min( Vec3d.x, Vec3d1.x ), Math.min( Vec3d.y, Vec3d1.y ), Math.min( Vec3d.z, Vec3d1.z ), Math.max( Vec3d.x, Vec3d1.x ), Math.max( Vec3d.y, Vec3d1.y ), Math.max( Vec3d.z, Vec3d1.z ) ).grow( 16, 16, 16 );
|
||||
|
||||
Entity entity = null;
|
||||
Vec3d entityIntersection = null;
|
||||
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
|
||||
double closest = 9999999.0D;
|
||||
|
||||
@@ -205,16 +198,17 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
|
||||
final float f1 = 0.3F;
|
||||
|
||||
final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().grow( f1, f1, f1 );
|
||||
final RayTraceResult RayTraceResult = boundingBox.calculateIntercept( Vec3d, Vec3d1 );
|
||||
final AxisAlignedBB boundingBox = entity1.getBoundingBox().grow( f1, f1, f1 );
|
||||
final Vec3d intersection = boundingBox.rayTrace( Vec3d, Vec3d1 ).orElse(null);
|
||||
|
||||
if( RayTraceResult != null )
|
||||
if( intersection != null )
|
||||
{
|
||||
final double nd = Vec3d.squareDistanceTo( RayTraceResult.hitVec );
|
||||
final double nd = Vec3d.squareDistanceTo( intersection );
|
||||
|
||||
if( nd < closest )
|
||||
{
|
||||
entity = entity1;
|
||||
entityIntersection = intersection;
|
||||
closest = nd;
|
||||
}
|
||||
}
|
||||
@@ -222,61 +216,66 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
}
|
||||
|
||||
RayTraceResult pos = w.rayTraceBlocks( Vec3d, Vec3d1, false );
|
||||
RayTraceContext rayTraceContext = new RayTraceContext(Vec3d, Vec3d1, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, p);
|
||||
RayTraceResult pos = w.rayTraceBlocks( rayTraceContext );
|
||||
|
||||
final Vec3d vec = new Vec3d( d0, d1, d2 );
|
||||
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
|
||||
if( entity != null && pos.getType() != RayTraceResult.Type.MISS && pos.getHitVec().squareDistanceTo( vec ) > closest )
|
||||
{
|
||||
pos = new RayTraceResult( entity );
|
||||
pos = new EntityRayTraceResult( entity, entityIntersection );
|
||||
}
|
||||
else if( entity != null && pos == null )
|
||||
else if( entity != null && pos.getType() == RayTraceResult.Type.MISS )
|
||||
{
|
||||
pos = new RayTraceResult( entity );
|
||||
pos = new EntityRayTraceResult( entity, entityIntersection );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
|
||||
AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos.getType() == RayTraceResult.Type.MISS ? 32 : pos.getHitVec().squareDistanceTo( vec ) + 1 ) ) );
|
||||
}
|
||||
catch( final Exception err )
|
||||
{
|
||||
AELog.debug( err );
|
||||
}
|
||||
|
||||
if( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
|
||||
if( pos.getType() != RayTraceResult.Type.MISS && type != null && type.getItem() instanceof ItemPaintBall )
|
||||
{
|
||||
final ItemPaintBall ipb = (ItemPaintBall) type.getItem();
|
||||
|
||||
final AEColor col = ipb.getColor( type );
|
||||
// boolean lit = ipb.isLumen( type );
|
||||
|
||||
if( pos.getType() == RayTraceResult.Type.ENTITY )
|
||||
if( pos instanceof EntityRayTraceResult )
|
||||
{
|
||||
final int id = pos.entityHit.getEntityId();
|
||||
EntityRayTraceResult entityResult = (EntityRayTraceResult) pos;
|
||||
Entity entityHit = entityResult.getEntity();
|
||||
|
||||
final int id = entityHit.getEntityId();
|
||||
final PlayerColor marker = new PlayerColor( id, col, 20 * 30 );
|
||||
TickHandler.INSTANCE.getPlayerColors().put( id, marker );
|
||||
|
||||
if( pos.entityHit instanceof EntitySheep )
|
||||
if( entityHit instanceof SheepEntity)
|
||||
{
|
||||
final EntitySheep sh = (EntitySheep) pos.entityHit;
|
||||
final SheepEntity sh = (SheepEntity) entityHit;
|
||||
sh.setFleeceColor( col.dye );
|
||||
}
|
||||
|
||||
pos.entityHit.attackEntityFrom( DamageSource.causePlayerDamage( p ), 0 );
|
||||
entityHit.attackEntityFrom( DamageSource.causePlayerDamage( p ), 0 );
|
||||
NetworkHandler.instance().sendToAll( marker.getPacket() );
|
||||
}
|
||||
else if( pos.typeOfHit == RayTraceResult.Type.BLOCK )
|
||||
else if( pos instanceof BlockRayTraceResult )
|
||||
{
|
||||
final Direction side = pos.sideHit;
|
||||
final BlockPos hitPos = pos.getBlockPos().offset( side );
|
||||
BlockRayTraceResult blockResult = (BlockRayTraceResult) pos;
|
||||
final Direction side = blockResult.getFace();
|
||||
final BlockPos hitPos = blockResult.getPos().offset( side );
|
||||
|
||||
if( !Platform.hasPermissions( new DimensionalCoord( w, hitPos ), p ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Block whatsThere = w.getBlockState( hitPos ).getBlock();
|
||||
if( whatsThere.isReplaceable( w, hitPos ) && w.isAirBlock( hitPos ) )
|
||||
final BlockState whatsThere = w.getBlockState( hitPos );
|
||||
if( whatsThere.getMaterial().isReplaceable() && w.isAirBlock( hitPos ) )
|
||||
{
|
||||
Api.INSTANCE.definitions().blocks().paint().maybeBlock().ifPresent( paintBlock -> {
|
||||
w.setBlockState( hitPos, paintBlock.getDefaultState(), 3 );
|
||||
@@ -286,7 +285,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
final TileEntity te = w.getTileEntity( hitPos );
|
||||
if( te instanceof TilePaint )
|
||||
{
|
||||
final Vec3d hp = pos.hitVec.subtract( hitPos.getX(), hitPos.getY(), hitPos.getZ() );
|
||||
final Vec3d hp = pos.getHitVec().subtract( hitPos.getX(), hitPos.getY(), hitPos.getZ() );
|
||||
( (TilePaint) te ).addBlot( type, side.getOpposite(), hp );
|
||||
}
|
||||
}
|
||||
@@ -303,6 +302,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
final AxisAlignedBB bb = new AxisAlignedBB( Math.min( Vec3d.x, Vec3d1.x ), Math.min( Vec3d.y, Vec3d1.y ), Math.min( Vec3d.z, Vec3d1.z ), Math.max( Vec3d.x, Vec3d1.x ), Math.max( Vec3d.y, Vec3d1.y ), Math.max( Vec3d.z, Vec3d1.z ) ).grow( 16, 16, 16 );
|
||||
|
||||
Entity entity = null;
|
||||
Vec3d entityIntersection = null;
|
||||
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
|
||||
double closest = 9999999.0D;
|
||||
|
||||
@@ -310,7 +310,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
{
|
||||
final Entity entity1 = (Entity) list.get( l );
|
||||
|
||||
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
|
||||
if( entity1.isAlive() && entity1 != p && !( entity1 instanceof ItemEntity ) )
|
||||
{
|
||||
if( entity1.isAlive() )
|
||||
{
|
||||
@@ -322,16 +322,17 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
|
||||
final float f1 = 0.3F;
|
||||
|
||||
final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().grow( f1, f1, f1 );
|
||||
final RayTraceResult RayTraceResult = boundingBox.calculateIntercept( Vec3d, Vec3d1 );
|
||||
final AxisAlignedBB boundingBox = entity1.getBoundingBox().grow( f1, f1, f1 );
|
||||
final Vec3d intersection = boundingBox.rayTrace( Vec3d, Vec3d1 ).orElse(null);
|
||||
|
||||
if( RayTraceResult != null )
|
||||
if( intersection != null )
|
||||
{
|
||||
final double nd = Vec3d.squareDistanceTo( RayTraceResult.hitVec );
|
||||
final double nd = Vec3d.squareDistanceTo( intersection );
|
||||
|
||||
if( nd < closest )
|
||||
{
|
||||
entity = entity1;
|
||||
entityIntersection = intersection;
|
||||
closest = nd;
|
||||
}
|
||||
}
|
||||
@@ -339,37 +340,40 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
}
|
||||
|
||||
RayTraceContext rayTraceContext = new RayTraceContext(Vec3d, Vec3d1, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, p);
|
||||
final Vec3d vec = new Vec3d( d0, d1, d2 );
|
||||
RayTraceResult pos = w.rayTraceBlocks( Vec3d, Vec3d1, true );
|
||||
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
|
||||
RayTraceResult pos = w.rayTraceBlocks( rayTraceContext );
|
||||
if( entity != null && pos.getType() != RayTraceResult.Type.MISS && pos.getHitVec().squareDistanceTo( vec ) > closest )
|
||||
{
|
||||
pos = new RayTraceResult( entity );
|
||||
pos = new EntityRayTraceResult( entity, entityIntersection );
|
||||
}
|
||||
else if( entity != null && pos == null )
|
||||
else if( entity != null && pos.getType() == RayTraceResult.Type.MISS )
|
||||
{
|
||||
pos = new RayTraceResult( entity );
|
||||
pos = new EntityRayTraceResult( entity, entityIntersection );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
|
||||
AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.x, (float) direction.y, (float) direction.z, (byte) ( pos.getType() == RayTraceResult.Type.MISS ? 32 : pos.getHitVec().squareDistanceTo( vec ) + 1 ) ) );
|
||||
}
|
||||
catch( final Exception err )
|
||||
{
|
||||
AELog.debug( err );
|
||||
}
|
||||
|
||||
if( pos != null )
|
||||
if( pos.getType() != RayTraceResult.Type.MISS )
|
||||
{
|
||||
final DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
|
||||
dmgSrc.damageType = "matter_cannon";
|
||||
final DamageSource dmgSrc = new EntityDamageSource( "matter_cannon", p );
|
||||
|
||||
if( pos.typeOfHit == RayTraceResult.Type.ENTITY )
|
||||
if( pos instanceof EntityRayTraceResult )
|
||||
{
|
||||
EntityRayTraceResult entityResult = (EntityRayTraceResult) pos;
|
||||
Entity entityHit = entityResult.getEntity();
|
||||
|
||||
final int dmg = (int) Math.ceil( penetration / 20.0f );
|
||||
if( pos.entityHit instanceof LivingEntity )
|
||||
if( entityHit instanceof LivingEntity )
|
||||
{
|
||||
final LivingEntity el = (LivingEntity) pos.entityHit;
|
||||
final LivingEntity el = (LivingEntity) entityHit;
|
||||
penetration -= dmg;
|
||||
el.knockBack( p, 0, -direction.x, -direction.z );
|
||||
// el.knockBack( p, 0, Vec3d.x,
|
||||
@@ -380,37 +384,38 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
hasDestroyed = true;
|
||||
}
|
||||
}
|
||||
else if( pos.entityHit instanceof EntityItem )
|
||||
else if( entityHit instanceof ItemEntity )
|
||||
{
|
||||
hasDestroyed = true;
|
||||
pos.entityHit.setDead();
|
||||
entityHit.remove();
|
||||
}
|
||||
else if( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) )
|
||||
else if( entityHit.attackEntityFrom( dmgSrc, dmg ) )
|
||||
{
|
||||
hasDestroyed = true;
|
||||
}
|
||||
}
|
||||
else if( pos.typeOfHit == RayTraceResult.Type.BLOCK )
|
||||
else if( pos instanceof BlockRayTraceResult )
|
||||
{
|
||||
BlockRayTraceResult blockResult = (BlockRayTraceResult) pos;
|
||||
|
||||
if( !AEConfig.instance().isFeatureEnabled( AEFeature.MASS_CANNON_BLOCK_DAMAGE ) )
|
||||
{
|
||||
penetration = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
final BlockState bs = w.getBlockState( pos.getBlockPos() );
|
||||
// int meta = w.getBlockMetadata(
|
||||
// pos.blockX, pos.blockY, pos.blockZ );
|
||||
BlockPos blockPos = blockResult.getPos();
|
||||
final BlockState bs = w.getBlockState(blockPos);
|
||||
|
||||
final float hardness = bs.getBlockHardness( w, pos.getBlockPos() ) * 9.0f;
|
||||
final float hardness = bs.getBlockHardness( w, blockPos) * 9.0f;
|
||||
if( hardness >= 0.0 )
|
||||
{
|
||||
if( penetration > hardness && Platform.hasPermissions( new DimensionalCoord( w, pos.getBlockPos() ), p ) )
|
||||
if( penetration > hardness && Platform.hasPermissions( new DimensionalCoord( w, blockPos), p ) )
|
||||
{
|
||||
hasDestroyed = true;
|
||||
penetration -= hardness;
|
||||
penetration *= 0.60;
|
||||
w.destroyBlock( pos.getBlockPos(), true );
|
||||
w.destroyBlock(blockPos, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
@@ -50,7 +50,7 @@ import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
|
||||
import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.items.contents.PortableCellViewer;
|
||||
@@ -68,17 +68,10 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity player, final Hand hand )
|
||||
{
|
||||
Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL );
|
||||
// FIXME Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL );
|
||||
return new ActionResult<>( ActionResultType.SUCCESS, player.getHeldItem( hand ) );
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public boolean isFull3D()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
@@ -145,7 +138,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
|
||||
@Override
|
||||
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
|
||||
{
|
||||
return GuiText.StorageCells.getUnlocalized();
|
||||
return GuiText.StorageCells.getTranslationKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,6 +30,7 @@ import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -63,13 +64,6 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
return new ActionResult<>( ActionResultType.SUCCESS, player.getHeldItem( hand ) );
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public boolean isFull3D()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addInformation( final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
@@ -85,17 +79,17 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
|
||||
if( encKey == null || encKey.isEmpty() )
|
||||
{
|
||||
lines.add( GuiText.Unlinked.getLocal() );
|
||||
lines.add( GuiText.Unlinked.textComponent() );
|
||||
}
|
||||
else
|
||||
{
|
||||
lines.add( GuiText.Linked.getLocal() );
|
||||
lines.add( GuiText.Linked.textComponent() );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lines.add( I18n.format( "AppEng.GuiITooltip.Unlinked" ) );
|
||||
lines.add( new TranslationTextComponent( "AppEng.GuiITooltip.Unlinked" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,12 @@ import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -50,7 +51,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
|
||||
public AEBasePoweredItem( final double powerCapacity )
|
||||
{
|
||||
super(new Properties().maxStackSize( 1 ).maxDamage( 32 ));
|
||||
super(new Properties().maxStackSize( 1 ).maxDamage( 32 ).setNoRepair());
|
||||
//FIXME
|
||||
// this.hasSubtypes = false;
|
||||
// this.setFull3D();
|
||||
@@ -73,8 +74,9 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
|
||||
final double percent = internalCurrentPower / internalMaxPower;
|
||||
|
||||
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform
|
||||
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||
lines.add( GuiText.StoredEnergy.textComponent().appendText( + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) )
|
||||
.appendSibling( new TranslationTextComponent( PowerUnits.AE.unlocalizedName ) )
|
||||
.appendText( " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,22 +86,15 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
|
||||
{
|
||||
super.getCheckedSubItems( creativeTab, itemStacks );
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
|
||||
super.fillItemGroup(group, items);
|
||||
|
||||
final ItemStack charged = new ItemStack( this, 1 );
|
||||
final CompoundNBT tag = charged.getOrCreateTag();
|
||||
tag.putDouble(CURRENT_POWER_NBT_KEY, this.getAEMaxPower( charged ));
|
||||
tag.putDouble(MAX_POWER_NBT_KEY, this.getAEMaxPower( charged ));
|
||||
|
||||
itemStacks.add( charged );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
items.add( charged );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,12 +21,11 @@ package appeng.items.tools.powered.powersink;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -45,41 +44,21 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
|
||||
|
||||
private final IAEItemPowerStorage item;
|
||||
|
||||
private final Object teslaAdapter;
|
||||
|
||||
PoweredItemCapabilities( ItemStack is, IAEItemPowerStorage item )
|
||||
{
|
||||
this.is = is;
|
||||
this.item = item;
|
||||
if( Capabilities.TESLA_CONSUMER != null || Capabilities.TESLA_HOLDER != null )
|
||||
{
|
||||
this.teslaAdapter = new TeslaAdapter();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.teslaAdapter = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability( Capability<?> capability, @Nullable Direction facing )
|
||||
{
|
||||
return capability == Capabilities.FORGE_ENERGY || capability == Capabilities.TESLA_CONSUMER || capability == Capabilities.TESLA_HOLDER;
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
@Override
|
||||
public <T> T getCapability( Capability<T> capability, @Nullable Direction facing )
|
||||
public <T> LazyOptional<T> getCapability(Capability<T> capability, @Nullable Direction facing )
|
||||
{
|
||||
if( capability == Capabilities.FORGE_ENERGY )
|
||||
{
|
||||
return (T) this;
|
||||
return (LazyOptional<T>) LazyOptional.of(() -> this);
|
||||
}
|
||||
else if( capability == Capabilities.TESLA_CONSUMER || capability == Capabilities.TESLA_HOLDER )
|
||||
{
|
||||
return (T) this.teslaAdapter;
|
||||
}
|
||||
return null;
|
||||
return LazyOptional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,25 +100,4 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
|
||||
return true;
|
||||
}
|
||||
|
||||
private class TeslaAdapter implements ITeslaConsumer, ITeslaHolder
|
||||
{
|
||||
|
||||
@Override
|
||||
public long givePower( long power, boolean simulated )
|
||||
{
|
||||
return PoweredItemCapabilities.this.receiveEnergy( (int) power, simulated );
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getStoredPower()
|
||||
{
|
||||
return PoweredItemCapabilities.this.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCapacity()
|
||||
{
|
||||
return PoweredItemCapabilities.this.getMaxEnergyStored();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user