Skip to content

Commit

Permalink
Refactor IceBlockBook to support rendering of active combination of
Browse files Browse the repository at this point in the history
composite items #1307
  • Loading branch information
athrane committed Feb 20, 2022
1 parent 809362e commit 975e33a
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/main/java/bassebombecraft/item/book/IceBlockBook.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package bassebombecraft.item.book;

import static bassebombecraft.config.ModConfiguration.iceBlockBook;
import static bassebombecraft.operator.DefaultPorts.getFnGetEntities1;
import static bassebombecraft.operator.DefaultPorts.getInstance;
import static bassebombecraft.item.RegisteredItems.FORMATION1;
import static bassebombecraft.item.RegisteredItems.MODIFIER11;
import static bassebombecraft.item.RegisteredItems.PROJECTILE3;

import java.util.function.Supplier;
import java.util.stream.Stream;

import bassebombecraft.operator.Operator2;
import bassebombecraft.operator.Sequence2;
import bassebombecraft.operator.entity.raytraceresult.SpawnIceBlock2;
import bassebombecraft.operator.projectile.ShootSkullProjectile2;
import bassebombecraft.operator.projectile.formation.SingleProjectileFormation2;
import bassebombecraft.operator.projectile.modifier.TagProjectileWithProjectileModifier;
import net.minecraft.item.Item;
import net.minecraftforge.fml.RegistryObject;

/**
* Book of ice block implementation.
Expand All @@ -21,16 +19,11 @@ public class IceBlockBook extends GenericCompositeItemsBook {
public static final String ITEM_NAME = IceBlockBook.class.getSimpleName();

/**
* Create operators.
* Composite items.
*/
static Supplier<Operator2> splOp = () -> {
Operator2 formationOp = new SingleProjectileFormation2();
Operator2 projectileOp = new ShootSkullProjectile2();
Operator2 modifierOp = new TagProjectileWithProjectileModifier(getFnGetEntities1(), p -> SpawnIceBlock2.NAME);
return new Sequence2(formationOp, projectileOp, modifierOp);
};
static Supplier<Stream<RegistryObject<Item>>> splComposites = () -> Stream.of(FORMATION1, PROJECTILE3, MODIFIER11);

public IceBlockBook() {
super(iceBlockBook, getInstance(), splOp.get());
super(iceBlockBook, splComposites);
}
}

0 comments on commit 975e33a

Please sign in to comment.