mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-17 10:24:23 +01:00
1.16.2 -> 1.16.4
This commit is contained in:
parent
b560e10a72
commit
22c295f1d6
9 changed files with 18 additions and 17 deletions
|
@ -13,7 +13,8 @@ import net.minecraft.util.registry.Registry;
|
||||||
public interface UEntities {
|
public interface UEntities {
|
||||||
|
|
||||||
EntityType<MagicProjectileEntity> THROWN_ITEM = register("thrown_item", FabricEntityTypeBuilder.<MagicProjectileEntity>create(SpawnGroup.MISC, MagicProjectileEntity::new)
|
EntityType<MagicProjectileEntity> THROWN_ITEM = register("thrown_item", FabricEntityTypeBuilder.<MagicProjectileEntity>create(SpawnGroup.MISC, MagicProjectileEntity::new)
|
||||||
.trackable(100, 2)
|
.trackRangeBlocks(100)
|
||||||
|
.trackedUpdateRate(2)
|
||||||
.dimensions(EntityDimensions.fixed(0.25F, 0.25F)));
|
.dimensions(EntityDimensions.fixed(0.25F, 0.25F)));
|
||||||
|
|
||||||
static <T extends Entity> EntityType<T> register(String name, FabricEntityTypeBuilder<T> builder) {
|
static <T extends Entity> EntityType<T> register(String name, FabricEntityTypeBuilder<T> builder) {
|
||||||
|
|
|
@ -20,8 +20,8 @@ import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||||
import net.minecraft.entity.effect.StatusEffects;
|
import net.minecraft.entity.effect.StatusEffects;
|
||||||
import net.minecraft.entity.mob.HostileEntity;
|
import net.minecraft.entity.mob.HostileEntity;
|
||||||
import net.minecraft.entity.passive.AbstractTraderEntity;
|
|
||||||
import net.minecraft.entity.passive.CowEntity;
|
import net.minecraft.entity.passive.CowEntity;
|
||||||
|
import net.minecraft.entity.passive.MerchantEntity;
|
||||||
import net.minecraft.entity.passive.PigEntity;
|
import net.minecraft.entity.passive.PigEntity;
|
||||||
import net.minecraft.entity.passive.SheepEntity;
|
import net.minecraft.entity.passive.SheepEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -66,7 +66,7 @@ public class ChangelingFeedAbility implements Ability<Hit> {
|
||||||
private boolean canDrain(Entity e) {
|
private boolean canDrain(Entity e) {
|
||||||
return (e instanceof LivingEntity)
|
return (e instanceof LivingEntity)
|
||||||
&& (e instanceof CowEntity
|
&& (e instanceof CowEntity
|
||||||
|| e instanceof AbstractTraderEntity
|
|| e instanceof MerchantEntity
|
||||||
|| e instanceof PlayerEntity
|
|| e instanceof PlayerEntity
|
||||||
|| e instanceof SheepEntity
|
|| e instanceof SheepEntity
|
||||||
|| e instanceof PigEntity
|
|| e instanceof PigEntity
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BlockPos getSolidBlockBelow(BlockPos pos, World w) {
|
private static BlockPos getSolidBlockBelow(BlockPos pos, World w) {
|
||||||
while (!World.isHeightInvalid(pos)) {
|
while (!World.isOutOfBuildLimitVertically(pos)) {
|
||||||
pos = pos.down();
|
pos = pos.down();
|
||||||
|
|
||||||
if (Block.isFaceFullSquare(w.getBlockState(pos).getCollisionShape(w, pos, ShapeContext.absent()), Direction.UP)) {
|
if (Block.isFaceFullSquare(w.getBlockState(pos).getCollisionShape(w, pos, ShapeContext.absent()), Direction.UP)) {
|
||||||
|
|
|
@ -323,7 +323,7 @@ public class Disguise implements NbtSerialisable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.method_30948()) {
|
if (entity.isCollidable()) {
|
||||||
output.accept(VoxelShapes.cuboid(entity.getBoundingBox()));
|
output.accept(VoxelShapes.cuboid(entity.getBoundingBox()));
|
||||||
} else if (entity instanceof FallingBlockEntity) {
|
} else if (entity instanceof FallingBlockEntity) {
|
||||||
BlockPos pos = entity.getBlockPos();
|
BlockPos pos = entity.getBlockPos();
|
||||||
|
|
|
@ -3,12 +3,12 @@ package com.minelittlepony.unicopia.entity.behaviour;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.DisguiseSpell;
|
import com.minelittlepony.unicopia.ability.magic.spell.DisguiseSpell;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
|
|
||||||
import net.minecraft.entity.passive.AbstractTraderEntity;
|
import net.minecraft.entity.passive.MerchantEntity;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
|
||||||
public class TraderBehaviour extends EntityBehaviour<AbstractTraderEntity> {
|
public class TraderBehaviour extends EntityBehaviour<MerchantEntity> {
|
||||||
@Override
|
@Override
|
||||||
public void update(Pony pony, AbstractTraderEntity entity, DisguiseSpell spell) {
|
public void update(Pony pony, MerchantEntity entity, DisguiseSpell spell) {
|
||||||
if (pony.sneakingChanged() && pony.getMaster().isSneaking()) {
|
if (pony.sneakingChanged() && pony.getMaster().isSneaking()) {
|
||||||
entity.setHeadRollingTimeLeft(40);
|
entity.setHeadRollingTimeLeft(40);
|
||||||
|
|
||||||
|
|
|
@ -60,15 +60,15 @@ public interface UItems {
|
||||||
URecipes.bootstrap();
|
URecipes.bootstrap();
|
||||||
|
|
||||||
FabricItemGroupBuilder.create(new Identifier("unicopia", "items")).appendItems(list -> {
|
FabricItemGroupBuilder.create(new Identifier("unicopia", "items")).appendItems(list -> {
|
||||||
list.addAll(VanillaOverrides.REGISTRY.stream().map(Item::getStackForRender).collect(Collectors.toList()));
|
list.addAll(VanillaOverrides.REGISTRY.stream().map(Item::getDefaultStack).collect(Collectors.toList()));
|
||||||
list.addAll(ITEMS.stream().map(Item::getStackForRender).collect(Collectors.toList()));
|
list.addAll(ITEMS.stream().map(Item::getDefaultStack).collect(Collectors.toList()));
|
||||||
}).icon(ZAP_APPLE::getStackForRender).build();
|
}).icon(ZAP_APPLE::getDefaultStack).build();
|
||||||
|
|
||||||
FabricItemGroupBuilder.create(new Identifier("unicopia", "horsefeed")).appendItems(list -> {
|
FabricItemGroupBuilder.create(new Identifier("unicopia", "horsefeed")).appendItems(list -> {
|
||||||
list.addAll(Registry.ITEM.stream()
|
list.addAll(Registry.ITEM.stream()
|
||||||
.filter(item -> item instanceof ToxicHolder && ((ToxicHolder)item).getToxic().isPresent())
|
.filter(item -> item instanceof ToxicHolder && ((ToxicHolder)item).getToxic().isPresent())
|
||||||
.map(Item::getStackForRender)
|
.map(Item::getDefaultStack)
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}).icon(ZAP_APPLE::getStackForRender).build();
|
}).icon(ZAP_APPLE::getDefaultStack).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class ZapAppleRecipe extends ShapelessRecipe {
|
||||||
throw new JsonParseException("Too many ingredients for shapeless recipe");
|
throw new JsonParseException("Too many ingredients for shapeless recipe");
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stack = UItems.ZAP_APPLE.getStackForRender();
|
ItemStack stack = UItems.ZAP_APPLE.getDefaultStack();
|
||||||
stack.getOrCreateTag().putString("appearance", JsonHelper.getString(json, "appearance"));
|
stack.getOrCreateTag().putString("appearance", JsonHelper.getString(json, "appearance"));
|
||||||
|
|
||||||
return new ZapAppleRecipe(identifier, group, stack, ingredients);
|
return new ZapAppleRecipe(identifier, group, stack, ingredients);
|
||||||
|
|
|
@ -24,7 +24,7 @@ public interface PosHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
static BlockPos findSolidGroundAt(World world, BlockPos pos) {
|
static BlockPos findSolidGroundAt(World world, BlockPos pos) {
|
||||||
while ((pos.getY() > 0 || !World.isHeightInvalid(pos))
|
while ((pos.getY() > 0 || !World.isInBuildLimit(pos))
|
||||||
&& (world.isAir(pos) || !world.getBlockState(pos).canPlaceAt(world, pos))) {
|
&& (world.isAir(pos) || !world.getBlockState(pos).canPlaceAt(world, pos))) {
|
||||||
pos = pos.down();
|
pos = pos.down();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class RayTraceHelper {
|
||||||
* @return A Trace describing what was found.
|
* @return A Trace describing what was found.
|
||||||
*/
|
*/
|
||||||
public static Trace doTrace(Entity e, double distance, float tickDelta, Predicate<Entity> predicate) {
|
public static Trace doTrace(Entity e, double distance, float tickDelta, Predicate<Entity> predicate) {
|
||||||
HitResult tracedBlock = e.rayTrace(distance, tickDelta, false);
|
HitResult tracedBlock = e.raycast(distance, tickDelta, false);
|
||||||
|
|
||||||
final Vec3d start = e.getCameraPosVec(tickDelta);
|
final Vec3d start = e.getCameraPosVec(tickDelta);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class RayTraceHelper {
|
||||||
)) {
|
)) {
|
||||||
Box entityAABB = entity.getBoundingBox().expand(entity.getTargetingMargin());
|
Box entityAABB = entity.getBoundingBox().expand(entity.getTargetingMargin());
|
||||||
|
|
||||||
Optional<Vec3d> intercept = entityAABB.rayTrace(start, end);
|
Optional<Vec3d> intercept = entityAABB.raycast(start, end);
|
||||||
|
|
||||||
if (entityAABB.contains(start)) {
|
if (entityAABB.contains(start)) {
|
||||||
if (traceDistance <= 0) {
|
if (traceDistance <= 0) {
|
||||||
|
|
Loading…
Reference in a new issue