More moves and compilation fixes

This commit is contained in:
Sebastian Hartte
2020-06-29 02:15:31 +02:00
parent 3df93fc66d
commit 0d63f560d3
240 changed files with 2221 additions and 1926 deletions
@@ -191,7 +191,7 @@ public final class MaterialItem extends AEBaseItem implements IStorageComponent,
throw new IllegalStateException(t);
}
eqi.setMotion(location.getMotion());
eqi.setVelocity(location.getVelocity());
if (location instanceof ItemEntity && eqi instanceof ItemEntity) {
((ItemEntity) eqi).setDefaultPickupDelay();
@@ -1,205 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.items.materials;
import java.util.EnumSet;
import java.util.Set;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import appeng.api.features.AEFeature;
import appeng.core.AppEng;
import appeng.core.features.MaterialStackSrc;
import appeng.entity.ChargedQuartzEntity;
import appeng.entity.SingularityEntity;
public enum MaterialType {
CERTUS_QUARTZ_CRYSTAL("certus_quartz_crystal", EnumSet.of(AEFeature.CERTUS), "crystalCertusQuartz"),
CERTUS_QUARTZ_CRYSTAL_CHARGED("charged_certus_quartz_crystal", EnumSet.of(AEFeature.CERTUS),
ChargedQuartzEntity.class),
CERTUS_QUARTZ_DUST("certus_quartz_dust", EnumSet.of(AEFeature.DUSTS, AEFeature.CERTUS), "dustCertusQuartz"),
NETHER_QUARTZ_DUST("nether_quartz_dust", EnumSet.of(AEFeature.DUSTS), "dustNetherQuartz,dustQuartz"),
FLOUR("flour", EnumSet.of(AEFeature.FLOUR), "dustWheat"),
GOLD_DUST("gold_dust", EnumSet.of(AEFeature.DUSTS), "dustGold"),
IRON_DUST("iron_dust", EnumSet.of(AEFeature.DUSTS), "dustIron"),
SILICON("silicon", EnumSet.of(AEFeature.SILICON), "itemSilicon"),
MATTER_BALL("matter_ball", EnumSet.of(AEFeature.MATTER_BALL)),
FLUIX_CRYSTAL("fluix_crystal", EnumSet.of(AEFeature.FLUIX), "crystalFluix"),
FLUIX_DUST("fluix_dust", EnumSet.of(AEFeature.FLUIX, AEFeature.DUSTS), "dustFluix"),
FLUIX_PEARL("fluix_pearl", EnumSet.of(AEFeature.FLUIX), "pearlFluix"),
PURIFIED_CERTUS_QUARTZ_CRYSTAL("purified_certus_quartz_crystal",
EnumSet.of(AEFeature.CERTUS, AEFeature.PURE_CRYSTALS), "crystalPureCertusQuartz"),
PURIFIED_NETHER_QUARTZ_CRYSTAL("purified_nether_quartz_crystal", EnumSet.of(AEFeature.PURE_CRYSTALS),
"crystalPureNetherQuartz"),
PURIFIED_FLUIX_CRYSTAL("purified_fluix_crystal", EnumSet.of(AEFeature.FLUIX, AEFeature.PURE_CRYSTALS),
"crystalPureFluix"),
CALCULATION_PROCESSOR_PRESS("calculation_processor_press", EnumSet.of(AEFeature.PRESSES)),
ENGINEERING_PROCESSOR_PRESS("engineering_processor_press", EnumSet.of(AEFeature.PRESSES)),
LOGIC_PROCESSOR_PRESS("logic_processor_press", EnumSet.of(AEFeature.PRESSES)),
CALCULATION_PROCESSOR_PRINT("printed_calculation_processor", EnumSet.of(AEFeature.PRINTED_CIRCUITS)),
ENGINEERING_PROCESSOR_PRINT("printed_engineering_processor", EnumSet.of(AEFeature.PRINTED_CIRCUITS)),
LOGIC_PROCESSOR_PRINT("printed_logic_processor", EnumSet.of(AEFeature.PRINTED_CIRCUITS)),
SILICON_PRESS("silicon_press", EnumSet.of(AEFeature.PRESSES)),
SILICON_PRINT("printed_silicon", EnumSet.of(AEFeature.PRINTED_CIRCUITS)),
NAME_PRESS("name_press", EnumSet.of(AEFeature.PRESSES)),
LOGIC_PROCESSOR("logic_processor", EnumSet.of(AEFeature.PROCESSORS)),
CALCULATION_PROCESSOR("calculation_processor", EnumSet.of(AEFeature.PROCESSORS)),
ENGINEERING_PROCESSOR("engineering_processor", EnumSet.of(AEFeature.PROCESSORS)),
// Basic Cards
BASIC_CARD("basic_card", EnumSet.of(AEFeature.BASIC_CARDS)),
CARD_REDSTONE("redstone_card", EnumSet.of(AEFeature.BASIC_CARDS)),
CARD_CAPACITY("capacity_card", EnumSet.of(AEFeature.BASIC_CARDS)),
// Adv Cards
ADVANCED_CARD("advanced_card", EnumSet.of(AEFeature.ADVANCED_CARDS)),
CARD_FUZZY("fuzzy_card", EnumSet.of(AEFeature.ADVANCED_CARDS)),
CARD_SPEED("speed_card", EnumSet.of(AEFeature.ADVANCED_CARDS)),
CARD_INVERTER("inverter_card", EnumSet.of(AEFeature.ADVANCED_CARDS)),
SPATIAL_2_CELL_COMPONENT("2_cubed_spatial_cell_component", EnumSet.of(AEFeature.SPATIAL_IO)),
SPATIAL_16_CELL_COMPONENT("16_cubed_spatial_cell_component", EnumSet.of(AEFeature.SPATIAL_IO)),
SPATIAL_128_CELL_COMPONENT("128_cubed_spatial_cell_component", EnumSet.of(AEFeature.SPATIAL_IO)),
ITEM_1K_CELL_COMPONENT("1k_cell_component", EnumSet.of(AEFeature.STORAGE_CELLS)),
ITEM_4K_CELL_COMPONENT("4k_cell_component", EnumSet.of(AEFeature.STORAGE_CELLS)),
ITEM_16K_CELL_COMPONENT("16k_cell_component", EnumSet.of(AEFeature.STORAGE_CELLS)),
ITEM_64K_CELL_COMPONENT("64k_cell_component", EnumSet.of(AEFeature.STORAGE_CELLS)),
EMPTY_STORAGE_CELL("empty_storage_cell", EnumSet.of(AEFeature.STORAGE_CELLS)),
WOODEN_GEAR("wooden_gear", EnumSet.of(AEFeature.GRIND_STONE), "gearWood"),
WIRELESS_RECEIVER("wireless_receiver", EnumSet.of(AEFeature.WIRELESS_ACCESS_TERMINAL)),
WIRELESS_BOOSTER("wireless_booster", EnumSet.of(AEFeature.WIRELESS_ACCESS_TERMINAL)),
FORMATION_CORE("formation_core", EnumSet.of(AEFeature.CORES)),
ANNIHILATION_CORE("annihilation_core", EnumSet.of(AEFeature.CORES)),
SKY_DUST("sky_dust", EnumSet.of(AEFeature.DUSTS)),
ENDER_DUST("ender_dust", EnumSet.of(AEFeature.QUANTUM_NETWORK_BRIDGE), "dustEnder,dustEnderPearl",
SingularityEntity.class),
SINGULARITY("singularity", EnumSet.of(AEFeature.QUANTUM_NETWORK_BRIDGE), SingularityEntity.class),
QUANTUM_ENTANGLED_SINGULARITY("quantum_entangled_singularity", EnumSet.of(AEFeature.QUANTUM_NETWORK_BRIDGE),
SingularityEntity.class),
BLANK_PATTERN("blank_pattern", EnumSet.of(AEFeature.PATTERNS)),
CARD_CRAFTING("crafting_card", EnumSet.of(AEFeature.ADVANCED_CARDS, AEFeature.CRAFTING_CPU)),
FLUID_1K_CELL_COMPONENT("1k_fluid_cell_component", EnumSet.of(AEFeature.STORAGE_CELLS)),
FLUID_4K_CELL_COMPONENT("4k_fluid_cell_component", EnumSet.of(AEFeature.STORAGE_CELLS)),
FLUID_16K_CELL_COMPONENT("16k_fluid_cell_component", EnumSet.of(AEFeature.STORAGE_CELLS)),
FLUID_64K_CELL_COMPONENT("64k_fluid_cell_component", EnumSet.of(AEFeature.STORAGE_CELLS));
private final Set<AEFeature> features;
private final Identifier registryName;
private Item itemInstance;
// stack!
private MaterialStackSrc stackSrc;
private String oreName;
private Class<? extends Entity> droppedEntity;
private boolean isRegistered = false;
MaterialType(String id, final Set<AEFeature> features) {
this.features = features;
this.registryName = new Identifier(AppEng.MOD_ID, id);
}
MaterialType(String id, final Set<AEFeature> features, final Class<? extends Entity> c) {
this(id, features);
this.droppedEntity = c;
}
MaterialType(String id, final Set<AEFeature> features, final String oreDictionary,
final Class<? extends Entity> c) {
this(id, features);
this.oreName = oreDictionary;
this.droppedEntity = c;
}
MaterialType(String id, final Set<AEFeature> features, final String oreDictionary) {
this(id, features);
this.oreName = oreDictionary;
}
public ItemStack stack(final int size) {
return new ItemStack(this.getItemInstance(), size);
}
public Set<AEFeature> getFeature() {
return this.features;
}
public String getOreName() {
return this.oreName;
}
boolean hasCustomEntity() {
return this.droppedEntity != null;
}
Class<? extends Entity> getCustomEntityClass() {
return this.droppedEntity;
}
public boolean isRegistered() {
return this.isRegistered;
}
public void markReady() {
this.isRegistered = true;
}
public Item getItemInstance() {
return this.itemInstance;
}
public void setItemInstance(final Item itemInstance) {
this.itemInstance = itemInstance;
}
public MaterialStackSrc getStackSrc() {
return this.stackSrc;
}
public void setStackSrc(final MaterialStackSrc stackSrc) {
this.stackSrc = stackSrc;
}
public String getId() {
return registryName.getPath();
}
public Identifier getRegistryName() {
return this.registryName;
}
}
@@ -32,13 +32,13 @@ import net.minecraft.block.Block;
import net.minecraft.block.Material;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.LiteralText;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.Identifier;
import net.minecraft.util.NonNullList;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.MathHelper;
import net.minecraft.text.Text;
import net.minecraft.world.World;
@@ -67,9 +67,9 @@ public class CrystalSeedItem extends AEBaseItem implements IGrowableCrystal {
/**
* The item to convert to, when growth finishes.
*/
private final IItemProvider grownItem;
private final ItemConvertible grownItem;
public CrystalSeedItem(Settings properties, IItemProvider grownItem) {
public CrystalSeedItem(Settings properties, ItemConvertible grownItem) {
super(properties);
this.grownItem = Preconditions.checkNotNull(grownItem);
// Expose the growth of the seed to the model system
@@ -122,11 +122,6 @@ public class CrystalSeedItem extends AEBaseItem implements IGrowableCrystal {
return new LiteralText(Math.round(100 * progress / (float) GROWTH_TICKS_REQUIRED) + "%");
}
@Override
public int getEntityLifespan(final ItemStack itemStack, final World world) {
return Integer.MAX_VALUE;
}
@Override
public boolean hasCustomEntity(final ItemStack stack) {
return true;
@@ -137,7 +132,7 @@ public class CrystalSeedItem extends AEBaseItem implements IGrowableCrystal {
final GrowingCrystalEntity egc = new GrowingCrystalEntity(world, location.getX(), location.getY(),
location.getZ(), itemstack);
egc.setMotion(location.getMotion());
egc.setVelocity(location.getVelocity());
// Cannot read the pickup delay of the original item, so we
// use the pickup delay used for items dropped by a player instead
@@ -147,8 +142,8 @@ public class CrystalSeedItem extends AEBaseItem implements IGrowableCrystal {
}
@Override
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
if (this.isInGroup(group)) {
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) {
if (this.isIn(group)) {
// lvl 0
items.add(new ItemStack(this, 1));
// one tick before maturity
@@ -30,7 +30,7 @@ import net.minecraft.tag.BlockTags;
import net.minecraft.tag.Tag;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.NonNullList;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.text.Text;
@@ -82,7 +82,7 @@ public class FacadeItem extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) {
}
public ItemStack createFacadeForItem(final ItemStack itemStack, final boolean returnItem) {
@@ -24,6 +24,7 @@ import net.fabricmc.api.EnvType;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.LiteralText;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
@@ -97,7 +98,7 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
}
@Override
public TransitionResult doSpatialTransition(final ItemStack is, final World w, final WorldCoord min,
public TransitionResult doSpatialTransition(final ItemStack is, final ServerWorld w, final WorldCoord min,
final WorldCoord max, int playerId) {
final int targetX = max.x - min.x - 1;
final int targetY = max.y - min.y - 1;
@@ -120,7 +121,7 @@ public class SpatialStorageCellItem extends AEBaseItem implements ISpatialStorag
try {
if (manager.isCellDimension(storedDim)) {
World cellWorld = manager.getWorld(storedDim);
ServerWorld cellWorld = manager.getWorld(storedDim);
BlockPos scale = manager.getCellDimensionSize(storedDim);
@@ -21,7 +21,7 @@ package appeng.items.tools.powered;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.util.math.Box;
import appeng.api.config.Actionable;
@@ -51,7 +51,7 @@ public class ChargedStaffItem extends AEBasePoweredItem {
new LightningPacket(dx, dy, dz));
}
}
target.attackEntityFrom(DamageSource.MAGIC, 6);
target.damage(DamageSource.MAGIC, 6);
return true;
}
@@ -30,13 +30,13 @@ import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.ActionResult;
import net.minecraft.util.DamageSource;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
@@ -253,7 +253,7 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
sh.setFleeceColor(col.dye);
}
entityHit.attackEntityFrom(DamageSource.causePlayerDamage(p), 0);
entityHit.damage(DamageSource.causePlayerDamage(p), 0);
NetworkHandler.instance().sendToAll(marker.getPacket());
} else if (pos instanceof BlockHitResult) {
BlockHitResult blockResult = (BlockHitResult) pos;
@@ -357,14 +357,14 @@ public class MatterCannonItem extends AEBasePoweredItem implements IStorageCell<
el.knockBack(p, 0, -direction.x, -direction.z);
// el.knockBack( p, 0, Vec3d.x,
// Vec3d.z );
el.attackEntityFrom(dmgSrc, dmg);
el.damage(dmgSrc, dmg);
if (!el.isAlive()) {
hasDestroyed = true;
}
} else if (entityHit instanceof ItemEntity) {
hasDestroyed = true;
entityHit.remove();
} else if (entityHit.attackEntityFrom(dmgSrc, dmg)) {
} else if (entityHit.damage(dmgSrc, dmg)) {
hasDestroyed = true;
}
} else if (pos instanceof BlockHitResult) {
@@ -28,7 +28,7 @@ import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.NonNullList;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.text.Text;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
@@ -79,10 +79,10 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
}
@Override
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> items) {
super.fillItemGroup(group, items);
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> items) {
super.appendStacks(group, items);
if (this.isInGroup(group)) {
if (this.isIn(group)) {
final ItemStack charged = new ItemStack(this, 1);
final CompoundTag tag = charged.getOrCreateTag();
tag.putDouble(CURRENT_POWER_NBT_KEY, this.getAEMaxPower(charged));