use of muramasa.antimatter.machine.Tier in project GT-4-Reimagined by Trinsdar.
the class CoverConveyor method onUpdate.
@Override
public void onUpdate(CoverStack<?> instance, Direction side) {
if (instance.getTile() == null || instance.getTile().getWorld().getGameTime() % (speeds.get(tier)) != 0)
return;
boolean isMachine = instance.getTile() instanceof TileEntityMachine;
BlockState state = instance.getTile().getWorld().getBlockState(instance.getTile().getPos().offset(side));
// Drop into world.
if (state == Blocks.AIR.getDefaultState() && isMachine) {
World world = instance.getTile().getWorld();
BlockPos pos = instance.getTile().getPos();
ItemStack stack = ((TileEntityMachine) instance.getTile()).itemHandler.map(ih -> Utils.extractAny(ih.getOutputHandler())).orElse(ItemStack.EMPTY);
if (stack.isEmpty())
return;
world.addEntity(new ItemEntity(world, pos.getX() + side.getXOffset(), pos.getY() + side.getYOffset(), pos.getZ() + side.getZOffset(), stack));
}
if (!(state.hasTileEntity()))
return;
TileEntity adjTile = instance.getTile().getWorld().getTileEntity(instance.getTile().getPos().offset(side));
if (adjTile == null) {
return;
}
if (isMachine) {
((TileEntityMachine) instance.getTile()).itemHandler.ifPresent(ih -> adjTile.getCapability(ITEM_HANDLER_CAPABILITY).ifPresent(other -> Utils.transferItems(ih.getOutputHandler(), other, true)));
} else {
Utils.transferItemsOnCap(instance.getTile(), adjTile, true);
}
}
use of muramasa.antimatter.machine.Tier in project AntimatterAPI by GregTech-Intergalactical.
the class Machine method addData.
protected void addData(Object... data) {
List<Tier> tiers = new ObjectArrayList<>();
Set<MachineFlag> flags = new ObjectOpenHashSet<>();
for (Object o : data) {
if (o instanceof RecipeMap) {
recipeMap = (RecipeMap<?>) o;
flags.add(RECIPE);
}
if (o instanceof Tier)
tiers.add((Tier) o);
if (o instanceof MachineFlag)
flags.add((MachineFlag) o);
if (o instanceof Texture)
baseTexture = (Texture) o;
if (o instanceof ItemGroup)
group = (ItemGroup) o;
// if (data[i] instanceof ITextureHandler) baseData = ((ITextureHandler) data[i]);
}
setTiers(tiers.size() > 0 ? tiers.toArray(new Tier[0]) : Tier.getStandard());
addFlags(flags.toArray(new MachineFlag[0]));
}
use of muramasa.antimatter.machine.Tier in project AntimatterAPI by GregTech-Intergalactical.
the class GuiData method add.
public GuiData add(String key, SlotData slot) {
// TODO figure out better way to do this
Tier tier = AntimatterAPI.get(Tier.class, key);
if (tier != null && tier.getVoltage() > highestTier.getVoltage())
highestTier = tier;
COUNT_LOOKUP.addTo(slot.getType(), 1);
if (SLOT_LOOKUP.containsKey(key)) {
SLOT_LOOKUP.get(key).add(slot);
} else {
List<SlotData> list = new ObjectArrayList<>();
list.add(slot);
SLOT_LOOKUP.put(key, list);
}
return this;
}
use of muramasa.antimatter.machine.Tier in project AntimatterAPI by GregTech-Intergalactical.
the class Machine method getTextures.
public List<Texture> getTextures() {
List<Texture> textures = new ObjectArrayList<>();
for (Tier tier : getTiers()) {
// textures.addAll(Arrays.asList(baseHandler.getBase(this, tier)));
textures.add(getBaseTexture(tier));
}
textures.addAll(Arrays.asList(getOverlayTextures(MachineState.IDLE)));
textures.addAll(Arrays.asList(getOverlayTextures(MachineState.ACTIVE)));
return textures;
}
Aggregations