net.minecraft.world.LocalDifficulty Java Examples

The following examples show how to use net.minecraft.world.LocalDifficulty. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractSkeletonEntityMixin.java    From the-hallow with MIT License 5 votes vote down vote up
@Inject(method = "initEquipment(Lnet/minecraft/world/LocalDifficulty;)V", at = @At(value = "TAIL"))
protected void initEquipment(LocalDifficulty ld, CallbackInfo cb) {
	Random random = new Random();
	if (HallowedConfig.TrumpetSkeleton.enabled && random.nextInt(HallowedConfig.TrumpetSkeleton.chance) == 0) {
		//noinspection ConstantConditions
		((AbstractSkeletonEntity) (Object) this).equipStack(EquipmentSlot.MAINHAND, new ItemStack(HallowedItems.TRUMPET));
	}
}
 
Example #2
Source File: MixinSpawnHelper.java    From patchwork-api with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Redirect(method = "spawnEntitiesInChunk", at = @At(value = "INVOKE", target = "net/minecraft/entity/mob/MobEntity.initialize(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnType;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/entity/EntityData;"))
private static EntityData hookSpecialSpawn(MobEntity entity, IWorld world, LocalDifficulty localDifficulty, SpawnType spawnType, EntityData data, CompoundTag tag) {
	if (!EntityEvents.doSpecialSpawn(entity, world, entity.x, entity.y, entity.z, null, spawnType)) {
		return entity.initialize(world, localDifficulty, spawnType, data, tag);
	} else {
		return data;
	}
}
 
Example #3
Source File: SpawnHelperMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Redirect(method = "spawnEntitiesInChunk", at = @At(
        value = "INVOKE",
        target = "Lnet/minecraft/entity/mob/MobEntity;initialize(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnType;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/entity/EntityData;"
))
private static EntityData spawnEntity(MobEntity mobEntity, IWorld iWorld_1, LocalDifficulty localDifficulty_1, SpawnType spawnType_1, EntityData entityData_1, CompoundTag compoundTag_1)
{
    if (!SpawnReporter.mock_spawns)
        return mobEntity.initialize(iWorld_1, localDifficulty_1, spawnType_1, entityData_1, compoundTag_1);
    return null;
}
 
Example #4
Source File: MobEntityMixin.java    From the-hallow with MIT License 4 votes vote down vote up
@Inject(method = "initialize(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/LocalDifficulty;Lnet/minecraft/entity/SpawnType;Lnet/minecraft/entity/EntityData;Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/entity/EntityData;", at = @At("RETURN"))
public void initialize(IWorld iWorld, LocalDifficulty localDifficulty, SpawnType spawnType, EntityData entityData, CompoundTag compoundTag, CallbackInfoReturnable<EntityData> cir) {
	if (((Object) this) instanceof EndermanEntity && HallowedConfig.PumpkinMobs.endermen && MixinHelpers.RANDOM.nextInt(10) == 0) {
		((EndermanEntity) (Object) this).setCarriedBlock((MixinHelpers.RANDOM.nextBoolean() ? Blocks.PUMPKIN : (MixinHelpers.RANDOM.nextBoolean() ? Blocks.CARVED_PUMPKIN : Blocks.JACK_O_LANTERN)).getDefaultState());
	}
}