Updated some API calls
This commit is contained in:
parent
f076a91da1
commit
6713e03088
14 changed files with 58 additions and 57 deletions
|
@ -78,9 +78,11 @@ public class BetterEnd implements ModInitializer {
|
|||
EndStructures.addBiomeStructures(biomeID, biome);
|
||||
}
|
||||
});
|
||||
if (RUNS_TRINKETS) {
|
||||
org.betterx.betterend.integration.trinkets.Elytra.register();
|
||||
}
|
||||
|
||||
//TODO: 1.20 Re-enable when Trinkets is back
|
||||
// if (RUNS_TRINKETS) {
|
||||
// org.betterx.betterend.integration.trinkets.Elytra.register();
|
||||
// }
|
||||
}
|
||||
|
||||
public static ResourceLocation makeID(String path) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.betterx.betterend.advancements;
|
|||
import org.betterx.betterend.BetterEnd;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.advancements.critereon.EntityPredicate;
|
||||
import net.minecraft.advancements.critereon.ContextAwarePredicate;
|
||||
import net.minecraft.advancements.critereon.PlayerTrigger;
|
||||
|
||||
public class BECriteria {
|
||||
|
@ -23,15 +23,15 @@ public class BECriteria {
|
|||
|
||||
PORTAL_ON_TRIGGER = new PlayerTrigger.TriggerInstance(
|
||||
PORTAL_ON.getId(),
|
||||
EntityPredicate.Composite.ANY
|
||||
ContextAwarePredicate.ANY
|
||||
);
|
||||
PORTAL_TRAVEL_TRIGGER = new PlayerTrigger.TriggerInstance(
|
||||
PORTAL_TRAVEL.getId(),
|
||||
EntityPredicate.Composite.ANY
|
||||
ContextAwarePredicate.ANY
|
||||
);
|
||||
INFUSION_FINISHED_TRIGGER = new PlayerTrigger.TriggerInstance(
|
||||
INFUSION_FINISHED.getId(),
|
||||
EntityPredicate.Composite.ANY
|
||||
ContextAwarePredicate.ANY
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,14 +29,10 @@ public class BuddingSmaragdantCrystalBlock extends LitPillarBlock implements Beh
|
|||
.strength(1F)
|
||||
.noOcclusion()
|
||||
.sound(SoundType.AMETHYST)
|
||||
.randomTicks());
|
||||
.randomTicks()
|
||||
.pushReaction(PushReaction.DESTROY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PushReaction getPistonPushReaction(BlockState blockState) {
|
||||
return PushReaction.DESTROY;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
|
||||
return Collections.emptyList();
|
||||
|
|
|
@ -139,7 +139,9 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
|||
@Override
|
||||
public void setItem(int slot, ItemStack stack) {
|
||||
ItemStack itemStack = inventory.get(slot);
|
||||
boolean stackValid = !stack.isEmpty() && stack.sameItem(itemStack) && ItemStack.tagMatches(stack, itemStack);
|
||||
boolean stackValid = !stack.isEmpty()
|
||||
&& ItemStack.isSameItem(stack, itemStack)
|
||||
&& ItemStack.isSameItemSameTags(stack, itemStack);
|
||||
inventory.set(slot, stack);
|
||||
if (stack.getCount() > getMaxStackSize()) {
|
||||
stack.setCount(getMaxStackSize());
|
||||
|
@ -174,10 +176,10 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
|||
level.getRecipeManager().byKey(entry.getKey()).ifPresent((recipe) -> {
|
||||
list.add(recipe);
|
||||
if (recipe instanceof AlloyingRecipe alloying) {
|
||||
dropExperience(player.level, player.position(), entry.getIntValue(), alloying.getExperience());
|
||||
dropExperience(player.level(), player.position(), entry.getIntValue(), alloying.getExperience());
|
||||
} else {
|
||||
BlastingRecipe blasting = (BlastingRecipe) recipe;
|
||||
dropExperience(player.level, player.position(), entry.getIntValue(), blasting.getExperience());
|
||||
dropExperience(player.level(), player.position(), entry.getIntValue(), blasting.getExperience());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -320,7 +322,7 @@ public class EndStoneSmelterBlockEntity extends BaseContainerBlockEntity impleme
|
|||
if (output.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (!output.sameItem(result)) {
|
||||
if (!ItemStack.isSameItem(output, result)) {
|
||||
return false;
|
||||
}
|
||||
if (outCount < getMaxStackSize() && outCount < output.getMaxStackSize()) {
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ColoredMaterial {
|
|||
}
|
||||
|
||||
public Block getByColor(DyeColor color) {
|
||||
return colors.get(color.getMaterialColor().col);
|
||||
return colors.get(color.getMapColor().col);
|
||||
}
|
||||
|
||||
public Block getByColor(int color) {
|
||||
|
@ -69,7 +69,7 @@ public class ColoredMaterial {
|
|||
|
||||
static {
|
||||
for (DyeColor color : DyeColor.values()) {
|
||||
int colorRGB = color.getMaterialColor().col;
|
||||
int colorRGB = color.getMapColor().col;
|
||||
COLORS.put(colorRGB, color.getName());
|
||||
DYES.put(colorRGB, DyeItem.byColor(color));
|
||||
}
|
||||
|
|
|
@ -130,8 +130,8 @@ public class CubozoaEntity extends AbstractSchoolingFish {
|
|||
protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
|
||||
int count = random.nextInt(3);
|
||||
if (count > 0) {
|
||||
ItemEntity drop = new ItemEntity(level, getX(), getY(), getZ(), new ItemStack(EndItems.GELATINE, count));
|
||||
this.level.addFreshEntity(drop);
|
||||
ItemEntity drop = new ItemEntity(level(), getX(), getY(), getZ(), new ItemStack(EndItems.GELATINE, count));
|
||||
this.level().addFreshEntity(drop);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ public class DragonflyEntity extends DespawnableAnimal implements FlyingAnimal {
|
|||
|
||||
@Override
|
||||
public boolean isFlying() {
|
||||
return !this.onGround;
|
||||
return !this.onGround();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -163,7 +163,7 @@ public class DragonflyEntity extends DespawnableAnimal implements FlyingAnimal {
|
|||
}
|
||||
|
||||
private Vec3 getRandomLocation() {
|
||||
int h = BlocksHelper.downRay(DragonflyEntity.this.level, DragonflyEntity.this.blockPosition(), 16);
|
||||
int h = BlocksHelper.downRay(DragonflyEntity.this.level(), DragonflyEntity.this.blockPosition(), 16);
|
||||
Vec3 rotation = DragonflyEntity.this.getViewVector(0.0F);
|
||||
Vec3 airPos = HoverRandomPos.getPos(DragonflyEntity.this, 8, 7, rotation.x, rotation.z, 1.5707964F, 3, 1);
|
||||
if (airPos != null) {
|
||||
|
@ -203,7 +203,7 @@ public class DragonflyEntity extends DespawnableAnimal implements FlyingAnimal {
|
|||
|
||||
private boolean isInVoid(Vec3 pos) {
|
||||
int h = BlocksHelper.downRay(
|
||||
DragonflyEntity.this.level,
|
||||
DragonflyEntity.this.level(),
|
||||
new BlockPos((int) pos.x, (int) pos.y, (int) pos.z),
|
||||
128
|
||||
);
|
||||
|
|
|
@ -137,7 +137,7 @@ public class EndFishEntity extends AbstractSchoolingFish {
|
|||
double x = getX() + random.nextGaussian() * 0.2;
|
||||
double y = getY() + random.nextGaussian() * 0.2;
|
||||
double z = getZ() + random.nextGaussian() * 0.2;
|
||||
level.addParticle(ParticleTypes.BUBBLE, x, y, z, 0, 0, 0);
|
||||
level().addParticle(ParticleTypes.BUBBLE, x, y, z, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ public class EndFishEntity extends AbstractSchoolingFish {
|
|||
item = EndItems.END_FISH_COOKED;
|
||||
}
|
||||
}
|
||||
ItemEntity drop = new ItemEntity(level, getX(), getY(), getZ(), new ItemStack(item));
|
||||
this.level.addFreshEntity(drop);
|
||||
ItemEntity drop = new ItemEntity(level(), getX(), getY(), getZ(), new ItemStack(item));
|
||||
this.level().addFreshEntity(drop);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ public class EndSlimeEntity extends Slime {
|
|||
@Override
|
||||
public void remove(RemovalReason reason) {
|
||||
int i = this.getSize();
|
||||
if (!this.level.isClientSide && i > 1 && this.isDeadOrDying()) {
|
||||
if (!this.level().isClientSide && i > 1 && this.isDeadOrDying()) {
|
||||
Component text = this.getCustomName();
|
||||
boolean bl = this.isNoAi();
|
||||
float f = (float) i / 4.0F;
|
||||
|
@ -145,7 +145,7 @@ public class EndSlimeEntity extends Slime {
|
|||
for (int l = 0; l < k; ++l) {
|
||||
float g = ((float) (l % 2) - 0.5F) * f;
|
||||
float h = ((float) (l / 2) - 0.5F) * f;
|
||||
EndSlimeEntity slimeEntity = (EndSlimeEntity) this.getType().create(this.level);
|
||||
EndSlimeEntity slimeEntity = (EndSlimeEntity) this.getType().create(this.level());
|
||||
if (this.isPersistenceRequired()) {
|
||||
slimeEntity.setPersistenceRequired();
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public class EndSlimeEntity extends Slime {
|
|||
this.random.nextFloat() * 360.0F,
|
||||
0.0F
|
||||
);
|
||||
this.level.addFreshEntity(slimeEntity);
|
||||
this.level().addFreshEntity(slimeEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,8 +182,8 @@ public class EndSlimeEntity extends Slime {
|
|||
minCount += looting;
|
||||
}
|
||||
int count = minCount < maxCount ? MHelper.randRange(minCount, maxCount, random) : maxCount;
|
||||
ItemEntity drop = new ItemEntity(level, getX(), getY(), getZ(), new ItemStack(Items.SLIME_BALL, count));
|
||||
this.level.addFreshEntity(drop);
|
||||
ItemEntity drop = new ItemEntity(level(), getX(), getY(), getZ(), new ItemStack(Items.SLIME_BALL, count));
|
||||
this.level().addFreshEntity(drop);
|
||||
}
|
||||
|
||||
public int getSlimeType() {
|
||||
|
@ -280,7 +280,7 @@ public class EndSlimeEntity extends Slime {
|
|||
0,
|
||||
(int) (dz * speed * 4)
|
||||
);
|
||||
int down = BlocksHelper.downRay(EndSlimeEntity.this.level, pos, 16);
|
||||
int down = BlocksHelper.downRay(EndSlimeEntity.this.level(), pos, 16);
|
||||
return down < 5;
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ public class EndSlimeEntity extends Slime {
|
|||
}
|
||||
|
||||
public boolean canUse() {
|
||||
return EndSlimeEntity.this.getTarget() == null && (EndSlimeEntity.this.onGround || EndSlimeEntity.this.isInWater() || EndSlimeEntity.this
|
||||
return EndSlimeEntity.this.getTarget() == null && (EndSlimeEntity.this.onGround() || EndSlimeEntity.this.isInWater() || EndSlimeEntity.this
|
||||
.isInLava() || EndSlimeEntity.this.hasEffect(MobEffects.LEVITATION)) && EndSlimeEntity.this.getMoveControl() instanceof EndSlimeMoveControl;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ public class EndSlimeEntity extends Slime {
|
|||
this.mob.setZza(0.0F);
|
||||
} else {
|
||||
this.operation = MoveControl.Operation.WAIT;
|
||||
if (this.mob.isOnGround()) {
|
||||
if (this.mob.onGround()) {
|
||||
this.mob.setSpeed((float) (this.speedModifier * this.mob.getAttributeValue(Attributes.MOVEMENT_SPEED)));
|
||||
if (this.ticksUntilJump-- <= 0) {
|
||||
this.ticksUntilJump = EndSlimeEntity.this.getJumpDelay();
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ShadowWalkerEntity extends Monster {
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
level.addParticle(
|
||||
level().addParticle(
|
||||
ParticleTypes.ASH,
|
||||
getX() + random.nextGaussian() * 0.2,
|
||||
getY() + random.nextGaussian() * 0.5 + 1,
|
||||
|
@ -60,7 +60,7 @@ public class ShadowWalkerEntity extends Monster {
|
|||
0,
|
||||
0
|
||||
);
|
||||
level.addParticle(
|
||||
level().addParticle(
|
||||
ParticleTypes.SMOKE,
|
||||
getX() + random.nextGaussian() * 0.2,
|
||||
getY() + random.nextGaussian() * 0.5 + 1,
|
||||
|
@ -69,7 +69,7 @@ public class ShadowWalkerEntity extends Monster {
|
|||
0,
|
||||
0
|
||||
);
|
||||
level.addParticle(
|
||||
level().addParticle(
|
||||
ParticleTypes.ENTITY_EFFECT,
|
||||
getX() + random.nextGaussian() * 0.2,
|
||||
getY() + random.nextGaussian() * 0.5 + 1,
|
||||
|
|
|
@ -95,7 +95,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
hivePos = NbtUtils.readBlockPos(tag.getCompound("HivePos"));
|
||||
ResourceLocation worldID = new ResourceLocation(tag.getString("HiveWorld"));
|
||||
try {
|
||||
hiveWorld = level.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, worldID));
|
||||
hiveWorld = level().getServer().getLevel(ResourceKey.create(Registries.DIMENSION, worldID));
|
||||
} catch (Exception e) {
|
||||
BetterEnd.LOGGER.warning("Silk Moth Hive World {} is missing!", worldID);
|
||||
hivePos = null;
|
||||
|
@ -148,7 +148,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
|
||||
@Override
|
||||
public boolean isFlying() {
|
||||
return !this.onGround;
|
||||
return !this.onGround();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -174,8 +174,8 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
}
|
||||
}
|
||||
int count = minCount < maxCount ? MHelper.randRange(minCount, maxCount, random) : maxCount;
|
||||
ItemEntity drop = new ItemEntity(level, getX(), getY(), getZ(), new ItemStack(EndItems.SILK_FIBER, count));
|
||||
this.level.addFreshEntity(drop);
|
||||
ItemEntity drop = new ItemEntity(level(), getX(), getY(), getZ(), new ItemStack(EndItems.SILK_FIBER, count));
|
||||
this.level().addFreshEntity(drop);
|
||||
}
|
||||
|
||||
class MothLookControl extends LookControl {
|
||||
|
@ -206,7 +206,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
@Override
|
||||
public void start() {
|
||||
Vec3 vec3d = null;
|
||||
if (SilkMothEntity.this.hivePos != null && SilkMothEntity.this.hiveWorld == SilkMothEntity.this.level) {
|
||||
if (SilkMothEntity.this.hivePos != null && SilkMothEntity.this.hiveWorld == SilkMothEntity.this.level()) {
|
||||
if (SilkMothEntity.this.position()
|
||||
.distanceToSqr(
|
||||
SilkMothEntity.this.hivePos.getX(),
|
||||
|
@ -252,7 +252,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
@Override
|
||||
public boolean canUse() {
|
||||
return SilkMothEntity.this.hivePos != null &&
|
||||
SilkMothEntity.this.hiveWorld == SilkMothEntity.this.level &&
|
||||
SilkMothEntity.this.hiveWorld == SilkMothEntity.this.level() &&
|
||||
SilkMothEntity.this.navigation.isDone() &&
|
||||
SilkMothEntity.this.random.nextInt(8) == 0 &&
|
||||
SilkMothEntity.this.position().distanceToSqr(
|
||||
|
@ -264,16 +264,16 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
|
||||
@Override
|
||||
public boolean canContinueToUse() {
|
||||
return SilkMothEntity.this.navigation.isInProgress() && level.getBlockState(entrance)
|
||||
.isAir() && (level.getBlockState(hivePos)
|
||||
.is(EndBlocks.SILK_MOTH_NEST) || level
|
||||
return SilkMothEntity.this.navigation.isInProgress() && level().getBlockState(entrance)
|
||||
.isAir() && (level().getBlockState(hivePos)
|
||||
.is(EndBlocks.SILK_MOTH_NEST) || level()
|
||||
.getBlockState(hivePos)
|
||||
.is(EndBlocks.SILK_MOTH_HIVE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
BlockState state = SilkMothEntity.this.level.getBlockState(SilkMothEntity.this.hivePos);
|
||||
BlockState state = SilkMothEntity.this.level().getBlockState(SilkMothEntity.this.hivePos);
|
||||
if (!state.is(EndBlocks.SILK_MOTH_NEST) && !state.is(EndBlocks.SILK_MOTH_HIVE)) {
|
||||
SilkMothEntity.this.hivePos = null;
|
||||
return;
|
||||
|
@ -295,7 +295,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
double dy = Math.abs(SilkMothEntity.this.entrance.getY() - SilkMothEntity.this.getY());
|
||||
double dz = Math.abs(SilkMothEntity.this.entrance.getZ() - SilkMothEntity.this.getZ());
|
||||
if (dx + dy + dz < 1) {
|
||||
BlockState state = SilkMothEntity.this.level.getBlockState(hivePos);
|
||||
BlockState state = SilkMothEntity.this.level().getBlockState(hivePos);
|
||||
if (state.is(EndBlocks.SILK_MOTH_NEST) || state.is(EndBlocks.SILK_MOTH_HIVE)) {
|
||||
int fullness = state.getValue(EndBlockProperties.FULLNESS);
|
||||
boolean isHive = state.is(EndBlocks.SILK_MOTH_HIVE);
|
||||
|
@ -310,7 +310,7 @@ public class SilkMothEntity extends Animal implements FlyingAnimal {
|
|||
state.setValue(EndBlockProperties.FULLNESS, fullness)
|
||||
);
|
||||
}
|
||||
SilkMothEntity.this.level.playSound(
|
||||
SilkMothEntity.this.level().playSound(
|
||||
null,
|
||||
SilkMothEntity.this.entrance,
|
||||
SoundEvents.BEEHIVE_ENTER,
|
||||
|
|
|
@ -37,7 +37,7 @@ public class MinecraftClientMixin {
|
|||
@Inject(method = "getSituationalMusic", at = @At("HEAD"), cancellable = true)
|
||||
private void be_getEndMusic(CallbackInfoReturnable<Music> info) {
|
||||
if (!(this.screen instanceof WinScreen) && this.player != null) {
|
||||
if (this.player.level.dimension() == Level.END) {
|
||||
if (this.player.level().dimension() == Level.END) {
|
||||
if (this.gui.getBossOverlay().shouldPlayMusic() && MHelper.lengthSqr(
|
||||
this.player.getX(),
|
||||
this.player.getZ()
|
||||
|
|
|
@ -49,7 +49,7 @@ public abstract class LivingEntityMixin extends Entity {
|
|||
|
||||
@Inject(method = "tickEffects", at = @At("HEAD"))
|
||||
protected void be_applyEffects(CallbackInfo info) {
|
||||
if (!level.isClientSide()) {
|
||||
if (!level().isClientSide()) {
|
||||
LivingEntity owner = LivingEntity.class.cast(this);
|
||||
if (CrystaliteArmor.hasFullSet(owner)) {
|
||||
CrystaliteArmor.applySetEffect(owner);
|
||||
|
|
|
@ -83,12 +83,12 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
|
|||
|
||||
@Inject(method = "changeDimension", at = @At("HEAD"), cancellable = true)
|
||||
public void be_changeDimension(ServerLevel destination, CallbackInfoReturnable<Entity> info) {
|
||||
if (be_canTeleport() && level instanceof ServerLevel) {
|
||||
if (be_canTeleport() && level() instanceof ServerLevel) {
|
||||
isChangingDimension = true;
|
||||
ServerLevel serverWorld = getLevel();
|
||||
LevelData worldProperties = destination.getLevelData();
|
||||
ServerPlayer player = ServerPlayer.class.cast(this);
|
||||
|
||||
|
||||
connection.send(new ClientboundRespawnPacket(
|
||||
destination.dimensionTypeId(),
|
||||
destination.dimension(),
|
||||
|
@ -98,7 +98,8 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
|
|||
destination.isDebug(),
|
||||
destination.isFlat(),
|
||||
(byte) 1,
|
||||
Optional.empty()
|
||||
Optional.empty(),
|
||||
getPortalCooldown()
|
||||
));
|
||||
connection.send(new ClientboundChangeDifficultyPacket(
|
||||
worldProperties.getDifficulty(),
|
||||
|
@ -113,7 +114,7 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
|
|||
serverWorld.getProfiler().push("moving");
|
||||
serverWorld.getProfiler().pop();
|
||||
serverWorld.getProfiler().push("placing");
|
||||
this.level = destination;
|
||||
this.setLevel(destination);
|
||||
destination.addDuringPortalTeleport(player);
|
||||
setRot(teleportTarget.yRot, teleportTarget.xRot);
|
||||
moveTo(teleportTarget.pos.x, teleportTarget.pos.y, teleportTarget.pos.z);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue