Skip to content

Commit

Permalink
Fix boats
Browse files Browse the repository at this point in the history
  • Loading branch information
Prospector committed Feb 29, 2020
1 parent 433094d commit e6fd621
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.Registry;

import java.util.Objects;
import java.util.function.Supplier;

public class TraverseEntities {
Expand All @@ -29,10 +31,14 @@ private static EntityType<TerraformBoatEntity> registerBoat(String name, ItemCon
Identifier id = new Identifier(Traverse.MOD_ID, name + "_boat");
Identifier skin = new Identifier(Traverse.MOD_ID, "textures/entity/boat/" + name + ".png");
Item item = Registry.register(Registry.ITEM, id, new TerraformBoatItem((world, x, y, z) -> {
TerraformBoatEntity entity = boatSupplier.get().create(world);
if (entity != null) {
entity.setPos(x, y, z);
}
TerraformBoatEntity entity = Objects.requireNonNull(boatSupplier.get().create(world), "null boat from EntityType::create");

entity.updatePosition(x, y, z);
entity.setVelocity(Vec3d.ZERO);
entity.prevX = x;
entity.prevY = y;
entity.prevZ = z;

return entity;
}, new Item.Settings().maxCount(1).group(ItemGroup.TRANSPORTATION)));
TerraformBoat boat = new TerraformBoat(item.asItem(), planks.asItem(), skin, vanilla);
Expand Down

0 comments on commit e6fd621

Please sign in to comment.