Skip to content

Commit

Permalink
✨ Updated to Minecraft 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCrayfish committed Aug 22, 2023
1 parent 31e7854 commit e1bdfbc
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ public void baseTick()
if(this.stunDelay == 0)
{
this.entityData.set(STUNNED, false);
this.level.playSound(null, this.getX(), this.getY(), this.getZ(), ModSounds.ENTITY_GOBLIN_TRADER_ANNOYED_GRUNT.get(), SoundSource.NEUTRAL, 1.0F, 0.9F + this.getRandom().nextFloat() * 0.2F);
this.level().playSound(null, this.getX(), this.getY(), this.getZ(), ModSounds.ENTITY_GOBLIN_TRADER_ANNOYED_GRUNT.get(), SoundSource.NEUTRAL, 1.0F, 0.9F + this.getRandom().nextFloat() * 0.2F);
}
}
if(!this.level.isClientSide() && (!Config.ENTITIES.preventDespawnIfNamed.get() || !this.isPersistenceRequired()))
if(!this.level().isClientSide() && (!Config.ENTITIES.preventDespawnIfNamed.get() || !this.isPersistenceRequired()))
{
this.handleDespawn();
}
Expand All @@ -170,7 +170,7 @@ else if(this.entityData.get(STUNNED))
{
this.fallCounter = 0;
}
if(!this.level.isClientSide() && this.getMaxRestockDelay() != -1)
if(!this.level().isClientSide() && this.getMaxRestockDelay() != -1)
{
if(++this.restockDelay >= this.getMaxRestockDelay())
{
Expand Down Expand Up @@ -243,9 +243,9 @@ public void notifyTrade(MerchantOffer offer)
{
this.tradedCustomers.add(this.customer.getUUID());
}
if(this.level instanceof ServerLevel)
if(this.level() instanceof ServerLevel serverLevel)
{
ExperienceOrb.award((ServerLevel) this.level, this.getPosition(1F), offer.getXp());
ExperienceOrb.award(serverLevel, this.getPosition(1F), offer.getXp());
}
}

Expand All @@ -255,16 +255,10 @@ public void notifyTradeUpdated(ItemStack stack)

}

@Override
public Level getLevel()
{
return this.level;
}

@Override
public boolean isClientSide()
{
return this.getLevel().isClientSide;
return this.level().isClientSide();
}

@Override
Expand Down Expand Up @@ -307,14 +301,14 @@ else if(this.isAlive() && !this.hasCustomer() && !this.isBaby() && (this.fireImm
{
if(this.getOffers().isEmpty())
{
return InteractionResult.sidedSuccess(this.level.isClientSide());
return InteractionResult.sidedSuccess(this.isClientSide());
}
else if(!this.level.isClientSide() && (this.getLastHurtByMob() == null || this.getLastHurtByMob() != player))
else if(!this.isClientSide() && (this.getLastHurtByMob() == null || this.getLastHurtByMob() != player))
{
this.setTradingPlayer(player);
this.openTradingScreen(player, this.getDisplayName(), 1);
}
return InteractionResult.sidedSuccess(this.level.isClientSide());
return InteractionResult.sidedSuccess(this.isClientSide());
}
return super.mobInteract(player, hand);
}
Expand All @@ -326,7 +320,7 @@ protected void triggerItemUseEffects(ItemStack stack, int count)
{
if(stack.getUseAnimation() == UseAnim.DRINK)
{
this.playSound(this.getDrinkingSound(stack), 0.5F, this.level.getRandom().nextFloat() * 0.1F + 0.9F);
this.playSound(this.getDrinkingSound(stack), 0.5F, this.level().getRandom().nextFloat() * 0.1F + 0.9F);
}
if(stack.getUseAnimation() == UseAnim.EAT)
{
Expand All @@ -347,13 +341,13 @@ protected void spawnFoodParticles(ItemStack stack, int count)
frontPosition = frontPosition.add(0, 0.35, 0);
frontPosition = frontPosition.add(this.position());
Vec3 motion = new Vec3(this.getRandom().nextDouble() * 0.2 - 0.1, 0.1, this.getRandom().nextDouble() * 0.2 - 0.1);
if(this.level instanceof ServerLevel)
if(this.level() instanceof ServerLevel serverLevel)
{
((ServerLevel) this.level).sendParticles(new ItemParticleOption(ParticleTypes.ITEM, stack), frontPosition.x, frontPosition.y, frontPosition.z, 1, motion.x, motion.y + 0.05D, motion.z, 0.0D);
serverLevel.sendParticles(new ItemParticleOption(ParticleTypes.ITEM, stack), frontPosition.x, frontPosition.y, frontPosition.z, 1, motion.x, motion.y + 0.05D, motion.z, 0.0D);
}
else
{
this.level.addParticle(new ItemParticleOption(ParticleTypes.ITEM, stack), frontPosition.x, frontPosition.y, frontPosition.z, motion.x, motion.y + 0.05D, motion.z);
this.level().addParticle(new ItemParticleOption(ParticleTypes.ITEM, stack), frontPosition.x, frontPosition.y, frontPosition.z, motion.x, motion.y + 0.05D, motion.z);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public ItemStack getFavouriteFood()
@Override
public void aiStep()
{
if(this.level.isClientSide() && this.tickCount % 2 == 0)
if(this.isClientSide() && this.tickCount % 2 == 0)
{
this.level.addParticle(ParticleTypes.FLAME, this.getX() - 0.5 + this.getRandom().nextDouble(), this.getY() + 0.5 - 0.5 + this.getRandom().nextDouble(), this.getZ() - 0.5 + this.getRandom().nextDouble(), 0, 0, 0);
this.level().addParticle(ParticleTypes.FLAME, this.getX() - 0.5 + this.getRandom().nextDouble(), this.getY() + 0.5 - 0.5 + this.getRandom().nextDouble(), this.getZ() - 0.5 + this.getRandom().nextDouble(), 0, 0, 0);
}
super.aiStep();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void tick()
if(this.entity.distanceTo(this.itemEntity) <= 1.0D && this.itemEntity.isAlive())
{
this.itemEntity.remove(Entity.RemovalReason.KILLED);
this.entity.level.playSound(null, this.itemEntity.getX(), this.itemEntity.getY(), this.itemEntity.getZ(), SoundEvents.ITEM_PICKUP, SoundSource.NEUTRAL, 1.0F, 0.75F);
this.entity.level().playSound(null, this.itemEntity.getX(), this.itemEntity.getY(), this.itemEntity.getZ(), SoundEvents.ITEM_PICKUP, SoundSource.NEUTRAL, 1.0F, 0.75F);
}
}

Expand All @@ -60,7 +60,7 @@ public boolean canContinueToUse()
@Nullable
private void findFavouriteFood()
{
List<ItemEntity> players = this.entity.level.getEntitiesOfClass(ItemEntity.class, this.entity.getBoundingBox().inflate(10), itemEntity -> itemEntity.getItem().getItem() == this.entity.getFavouriteFood().getItem());
List<ItemEntity> players = this.entity.level().getEntitiesOfClass(ItemEntity.class, this.entity.getBoundingBox().inflate(10), itemEntity -> itemEntity.getItem().getItem() == this.entity.getFavouriteFood().getItem());
if(players.size() > 0)
{
this.itemEntity = players.stream().min(Comparator.comparing(this.entity::distanceTo)).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public boolean canUse()
{
if(this.goblin.isOnFire() && !this.goblin.isStunned())
{
BlockPos blockpos = this.getClosestWaterPos(this.goblin.level, this.goblin, 5, 4);
BlockPos blockpos = this.getClosestWaterPos(this.goblin.level(), this.goblin, 5, 4);
if(blockpos != null)
{
this.randPosX = (double) blockpos.getX();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void stop()
@Nullable
private void findCustomer()
{
List<Player> players = this.entity.level.getEntitiesOfClass(Player.class, this.entity.getBoundingBox().inflate(10), playerEntity -> !playerEntity.isCreative() && !playerEntity.isSpectator());
List<Player> players = this.entity.level().getEntitiesOfClass(Player.class, this.entity.getBoundingBox().inflate(10), playerEntity -> !playerEntity.isCreative() && !playerEntity.isSpectator());
if(players.size() > 0)
{
this.potentialCustomer = players.stream().min(Comparator.comparing(this.entity::distanceTo)).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ else if(this.entity.isInWater())
{
return false;
}
else if(!this.entity.isOnGround())
else if(!this.entity.onGround())
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private boolean isMatching(ItemStack given, ItemStack payment)
givenCopy.setDamageValue(givenCopy.getDamageValue());
}

if(!ItemStack.isSame(givenCopy, payment))
if(!ItemStack.isSameItem(givenCopy, payment))
return false;

if(!payment.hasTag())
Expand Down
1 change: 1 addition & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
modImplementation "com.mrcrayfish:framework-fabric:${minecraft_version}-${framework_version}"
modRuntimeOnly "com.mrcrayfish:catalogue-fabric:${minecraft_version}-1.7.1"
implementation "com.google.code.findbugs:jsr305:3.0.2"
implementation project(":common")
testModImplementation sourceSets.main.output
Expand Down
2 changes: 1 addition & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ configurations {
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation fg.deobf("com.mrcrayfish:framework-forge:${minecraft_version}-${framework_version}")
runtimeOnly fg.deobf("com.mrcrayfish:catalogue-forge:${minecraft_version}-1.7.0")
runtimeOnly fg.deobf("com.mrcrayfish:catalogue-forge:${minecraft_version}-1.7.1")
compileOnly project(":common")
testCompileOnly project(":common")
annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT:processor")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public GoblinTraders()
{
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
bus.addListener(this::onCommonSetup);
bus.addListener(this::onClientSetup);
bus.addListener(this::onGatherData);
MinecraftForge.EVENT_BUS.addListener(this::onEntityAttributeCreation);
bus.addListener(this::onEntityAttributeCreation);
MinecraftForge.EVENT_BUS.addListener(this::addReloadListener);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.event.CreativeModeTabEvent;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

Expand All @@ -34,9 +34,9 @@ public static void registerEntityRenderers(EntityRenderersEvent.RegisterLayerDef
}

@SubscribeEvent
public static void onRegisterCreativeTab(CreativeModeTabEvent.BuildContents event)
public static void onRegisterCreativeTab(BuildCreativeModeTabContentsEvent event)
{
if(event.getTab().equals(CreativeModeTabs.SPAWN_EGGS))
if(event.getTabKey().equals(CreativeModeTabs.SPAWN_EGGS))
{
event.accept(ModItems.GOBLIN_TRADER_SPAWN_EGG.get());
event.accept(ModItems.VEIN_GOBLIN_TRADER_SPAWN_EGG.get());
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
group=com.mrcrayfish

# Common
minecraft_version=1.19.4
minecraft_version=1.20.1

# Forge
forge_version=45.1.0
forge_version=47.0.43

# Fabric
fabric_version=0.87.0+1.19.4
fabric_version=0.87.0+1.20.1
fabric_loader_version=0.14.22

# Mod options
Expand Down

0 comments on commit e1bdfbc

Please sign in to comment.