@Override
 public ItemStack getRecipeOutput() {
   Optional<Item> nominalOutput = recipe.getNominalOutput();
   if (nominalOutput.isPresent()) {
     return Game.natives().toNative(nominalOutput.get());
   }
   return null;
 }
 @Override
 public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
   Optional<Item> craftingResult = recipe.getCraftingResult(MCCraftingGrid.get(inventoryCrafting));
   if (craftingResult.isPresent()) {
     return Game.natives().toNative(craftingResult.get());
   } else {
     return null;
   }
 }
Beispiel #3
0
 @Override
 public boolean setBlock(Vector3D position, BlockFactory blockFactory, Object... args) {
   // TODO: Implement object arguments
   net.minecraft.block.Block mcBlock = Game.natives().toNative(blockFactory.getDummy());
   return world()
       .setBlock(
           (int) position.getX(),
           (int) position.getY(),
           (int) position.getZ(),
           mcBlock != null ? mcBlock : Blocks.air);
 }
Beispiel #4
0
 @Override
 public Entity addEntity(Vector3D position, Item item) {
   EntityItem entityItem =
       new EntityItem(
           world(),
           position.getX(),
           position.getY(),
           position.getZ(),
           Game.natives().toNative(item));
   world().spawnEntityInWorld(entityItem);
   return new BWEntity(entityItem);
 }
Beispiel #5
0
 @Override
 public Set<Entity> getEntities(Cuboid bound) {
   return (Set)
       world()
           .getEntitiesWithinAABB(
               Entity.class,
               AxisAlignedBB.getBoundingBox(
                   bound.min.getX(),
                   bound.min.getY(),
                   bound.min.getZ(),
                   bound.max.getX(),
                   bound.max.getY(),
                   bound.max.getZ()))
           .stream()
           .map(
               mcEnt ->
                   Game.natives()
                       .getNative(Entity.class, net.minecraft.entity.Entity.class)
                       .toNova((net.minecraft.entity.Entity) mcEnt))
           .collect(Collectors.toSet());
 }
 public MinecraftItemIngredient(net.minecraft.item.ItemStack itemStack) {
   super(((Item) Game.natives().toNova(itemStack)).getID());
 }
Beispiel #7
0
 @Override
 public Optional<Entity> getEntity(String uniqueID) {
   return Optional.ofNullable(
       Game.natives().toNova(world().getEntityByID(Integer.parseInt(uniqueID))));
 }