@Override public List<? extends com.sk89q.worldedit.world.World> getWorlds() { WorldServer[] worlds = DimensionManager.getWorlds(); List<com.sk89q.worldedit.world.World> ret = new ArrayList<>(worlds.length); for (WorldServer world : worlds) { ret.add(new ForgeWorld(world)); } return ret; }
@Override public NonNullList<ItemStack> getRemainingItems( final InventoryCrafting inv ) { return ForgeHooks.defaultRecipeGetRemainingItems( inv ); } }
@Override public boolean canSustainPlant(@Nonnull IBlockState state, @Nonnull IBlockAccess world, BlockPos pos, @Nonnull EnumFacing direction, IPlantable plantable) { // can sustain both slimeplants and normal plants return plantable.getPlantType(world, pos) == TinkerWorld.slimePlantType || plantable.getPlantType(world, pos) == EnumPlantType.Plains; }
@Override public ISpatialDimension getSpatialDimension() { final int id = AppEng.instance().getStorageDimensionID(); World w = DimensionManager.getWorld( id ); if( w == null ) { DimensionManager.initDimension( id ); w = DimensionManager.getWorld( id ); } if( w != null && w.hasCapability( Capabilities.SPATIAL_DIMENSION, null ) ) { return w.getCapability( Capabilities.SPATIAL_DIMENSION, null ); } return null; }
public boolean shearEntity(ItemStack stack, World world, EntityPlayer player, Entity entity, int fortune) { if(!(entity instanceof IShearable)) { return false; } IShearable shearable = (IShearable) entity; if(shearable.isShearable(stack, world, entity.getPosition())) { if(!world.isRemote) { List<ItemStack> drops = shearable.onSheared(stack, world, entity.getPosition(), fortune); Random rand = world.rand; for(ItemStack drop : drops) { EntityItem entityItem = entity.entityDropItem(drop, 1.0F); if(entityItem != null) { entityItem.motionY += rand.nextFloat() * 0.05F; entityItem.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; entityItem.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; } } } ToolHelper.damageTool(stack, 1, player); return true; } return false; }
@SubscribeEvent public void attachSpatialDimensionManager( AttachCapabilitiesEvent<World> event ) { if( AEConfig.instance() .isFeatureEnabled( AEFeature.SPATIAL_IO ) && event.getObject() == DimensionManager.getWorld( AEConfig.instance().getStorageDimensionID() ) ) { event.addCapability( new ResourceLocation( "appliedenergistics2:spatial_dimension_manager" ), new SpatialDimensionManager( event.getObject() ) ); } }
@Override public ArmorProperties getProperties(EntityLivingBase player, @Nonnull ItemStack armor, DamageSource source, double damage, int slot) { if(source.isUnblockable()) return new ArmorProperties(0, 0, 0); return new ArmorProperties(0, damageReduceAmount / 25D, armor.getMaxDamage() + 1 - armor.getItemDamage()); }
config.setStorageDimensionID( DimensionManager.getNextFreeDimId() ); config.save(); DimensionManager.registerDimension( this.storageDimensionID, this.storageDimensionType );
@Override public void invalidate() { if( Platform.isClient() ) { return; } AELog.info( "Released Ticket " + this.ct.toString() ); ForgeChunkManager.releaseTicket( this.ct ); } }
/** * Requires to start up from external from here * * drawback of the singleton build style * * @param server */ public static void onServerAboutToStart( MinecraftServer server ) { File worldDirectory = DimensionManager.getCurrentSaveRootDirectory(); if( worldDirectory == null ) { worldDirectory = server.getActiveAnvilConverter().getSaveLoader( server.getFolderName(), false ).getWorldDirectory(); } final WorldData newInstance = new WorldData( worldDirectory ); instance = newInstance; newInstance.onServerStarting(); }
public BlockChunkloader() { super( Material.IRON ); ForgeChunkManager.setForcedChunkLoadingCallback( AppEng.instance(), this ); }
if(block instanceof IShearable) { IShearable target = (IShearable) block; if(target.isShearable(itemstack, world, pos)) { int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, itemstack); List<ItemStack> drops = target.onSheared(itemstack, world, pos, fortune);
@Override public boolean canSustainPlant(@Nonnull IBlockState state, @Nonnull IBlockAccess world, BlockPos pos, @Nonnull EnumFacing direction, IPlantable plantable) { // can sustain both slimeplants and normal plants return plantable.getPlantType(world, pos) == TinkerWorld.slimePlantType || plantable.getPlantType(world, pos) == EnumPlantType.Plains; }
@Override public NonNullList<ItemStack> getRemainingItems( final InventoryCrafting inv ) { return ForgeHooks.defaultRecipeGetRemainingItems( inv ); } }
@Nullable @Override public World matchWorld(World world) { if (world instanceof ForgeWorld) { return world; } else { for (WorldServer ws : DimensionManager.getWorlds()) { if (ws.getWorldInfo().getWorldName().equals(world.getName())) { return new ForgeWorld(ws); } } return null; } }
@Override public boolean itemInteractionForEntity(@Nonnull ItemStack itemstack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) { if(entity.world.isRemote) return false; if(entity instanceof IShearable) { IShearable target = (IShearable)entity; if(target.isShearable(itemstack, entity.world, new BlockPos(entity))) { List<ItemStack> drops = target.onSheared(itemstack, entity.world, new BlockPos(entity), EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, itemstack)); for(ItemStack stack : drops) { entity.entityDropItem(stack, 1.0F); } ToolCommons.damageItem(itemstack, 1, player, MANA_PER_DAMAGE); } return true; } return false; }
@Override public boolean canSustainPlant(@Nonnull IBlockState state, @Nonnull IBlockAccess world, BlockPos pos, @Nonnull EnumFacing direction, IPlantable plantable) { EnumPlantType type = plantable.getPlantType(world, pos.down()); return type == EnumPlantType.Plains || type == EnumPlantType.Beach; }
@Override public boolean canSustainPlant(@Nonnull IBlockState state, @Nonnull IBlockAccess world, BlockPos pos, @Nonnull EnumFacing direction, IPlantable plantable) { SoilTypes type = world.getBlockState(pos).getValue(TYPE); if(type == SoilTypes.SLIMY_MUD_GREEN || type == SoilTypes.SLIMY_MUD_BLUE) { // can sustain slimeplants return plantable.getPlantType(world, pos) == TinkerWorld.slimePlantType; } return super.canSustainPlant(state, world, pos, direction, plantable); }
@Override public boolean canSustainPlant(@Nonnull IBlockState state, @Nonnull IBlockAccess world, BlockPos pos, @Nonnull EnumFacing direction, IPlantable plantable) { return plantable.getPlantType(world, pos.down()) == EnumPlantType.Plains; }